I have a file that has data like:
1,0,3,5,7,4,2,7,8,1,5,2,1,4,7,8,
These are just arbitrary numbers for the sake of example, but the values will never be more than 2 digit integers.
I've run into several problems with this. It only accepts characters, so I'm not sure how to read in a two digit integer. Even worse, is my code to read in single digit integers is still not working.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
string filename = "test.txt";
file.open(filename, ifstream::in);
int i = 0;
char buffer[16];
if(file.is_open())
{
while(file.good())
{
file.getline(&buffer[i], 3, ',');
file.ignore(1);
i++;
}
file.close();
}
|