+ 1

How to read data from text file into dynamic 2D character array in c++?

I want to read a bunch of names from text file into the 2 2d array.The problem is I only know the total numbers of names but do not know their lengths.kindly help!

8th Sep 2019, 3:29 PM
CoDeR_242
CoDeR_242 - avatar
11 Réponses
+ 1
Use vector of strings, then push to vector each name from file
8th Sep 2019, 3:43 PM
Elva
Elva - avatar
+ 1
Can't use vector or strings because this has to be done through character Arrays
8th Sep 2019, 3:48 PM
CoDeR_242
CoDeR_242 - avatar
+ 1
Here's a hack, don't know if I u are permitted to use it, use vector of strings, then covert c++ string to c string, aka char*
8th Sep 2019, 3:57 PM
Elva
Elva - avatar
8th Sep 2019, 4:02 PM
Elva
Elva - avatar
+ 1
~ swim ~ thank you so much
8th Sep 2019, 4:17 PM
CoDeR_242
CoDeR_242 - avatar
0
Datafile is already created and i only know the total names which are 44 in numbers
8th Sep 2019, 3:55 PM
CoDeR_242
CoDeR_242 - avatar
0
But the length of each name is unknown to me
8th Sep 2019, 3:56 PM
CoDeR_242
CoDeR_242 - avatar
0
We haven't study vectors yet therefore can't use them
8th Sep 2019, 3:59 PM
CoDeR_242
CoDeR_242 - avatar