dmontgom
asked on
Open Text File of Numbers into an Array
I have a text file with a header row of variables and the rest as numbers in columns. I can open the file using getline but it reads the number rows as a string. What I then have to do is break each string of row numbers down by looking for tab spaces, converting the string to a number, and then saving it into an array. Can somebody please tell me the easiest way to open a text file of numbers with various rows and columns into an array?
Thanks
Thanks
i.e what yonat is saying is that the standard library is capable of reading the ASCII data and converting the digits into integers (or other numerical types) so don't read the data in as ASCII characters, read it in as the numerical type you want.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
while (cin >> i) {
// do stuff with i
}