This is what I have so far, but, of course, it doesn't work (it NEVER exits the loop)
Code:
void InputFile() {
string Read;
bool WriteToFile;
int Index = 0;
ifstream fin;
ofstream fout;
fin.open("Coordinates.txt");
fout.open("Formatted coords.txt");
if(fin.fail())
MessageBox(NULL, "File Input Initialization Failed", "FAILURE", MB_OK);
if(fout.fail())
MessageBox(NULL, "File Output Initialization Failed", "FAILURE", MB_OK);
while(fin.good()) {
fin >> Read;
WriteToFile = true;
if(Index < 15)
if(Read == "(")
WriteToFile = false;
if(Read == ")")
WriteToFile = false;
if(WriteToFile)
fout << Read << endl;
if(Index == 15) { //THIS IS THE LAST PARENTHESIS OF THE LINE
Index = 0; //RESET INDEX TO ZERO
fin.seekg('\n');//SEEK TO THE END OF THE LINE
}
else
Index++; //OTHERWISE ADVANCE INDEX
if(Index >= 16)
MessageBox(NULL, "GREATER THAN 16", ">16", MB_OK);
}
fin.close();
fout.close();
}
I am just bewildered with this because it seemed like such an easy task, but nothing I have done has worked so I'm pretty upset.