This is a run time error that occurs when the program is shut down, I get the correct functionality up until that point.
Here is the code block
Expand|Select|Wrap|Line Numbers
- int xPos[32];
- int yPos[32];
- char buffer[256];
- char line[255];
- int i = 0;
- string newstring;
- // Convert all the input data to integer arrays
- do
- {
- // Data before the comma
- fIn.getline(line, sizeof(buffer), ',');
- newstring.assign(line);
- xPos[i] = atoi(newstring.c_str());
- // Data after the comma
- fIn.getline(line, sizeof(buffer));
- newstring.assign(line);
- yPos[i] = atoi(newstring.c_str());
- // Increment array iterator and continue looping down the file's lines until end of file
- i++;
- }while(!fIn.eof());
- fIn.close();
- cout << xPos[31] << ", " << yPos[31] << endl;
I am pulling integer values out of a .csv file if that helps.