+ 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!
11 Réponses
+ 1
Use vector of strings, then push to vector each name from file
+ 1
Can't use vector or strings because this has to be done through character Arrays
+ 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*
+ 1
Learn to use stack overflow as well: https://stackoverflow.com/questions/16870485/how-can-i-read-an-input-string-of-unknown-length
+ 1
~ swim ~ thank you so much
0
Datafile is already created and i only know the total names which are 44 in numbers
0
But the length of each name is unknown to me
0
We haven't study vectors yet therefore can't use them