G
Greg
I am trying to convert an older console application written in C to a
visual application using several Borland VCL components (open and save
dialogs). I am declaring input and output stream variables as follows:
ifstream InputFile;
ofstream OutputFile;
I am initializing them using the filename properties in the "open" and
"save" dialogs respectively, with the "._C_str" modifier attached to
the end. The files to be read are comma separated variable type with
5000 to 30000 data pairs. I was trying to use "InputFile.getline(line,
81)", but when I use it in the following while loop, I get runtime
exception errors that look like language exceptions:
while( ! InputFile.eof ( ))
{
InputFile.getline(line, 81);
and more stuff;
}
Two additional notes: 1) I can continue to run the program after the
exception dialog is closed, and the output file appears fine, and 2) If
I replace the while loop with a for loop, I don't get exceptions.
However, I'd rather use the while loop (much neater for my application)
Any help would be appreciated.
Thanks in advance.
visual application using several Borland VCL components (open and save
dialogs). I am declaring input and output stream variables as follows:
ifstream InputFile;
ofstream OutputFile;
I am initializing them using the filename properties in the "open" and
"save" dialogs respectively, with the "._C_str" modifier attached to
the end. The files to be read are comma separated variable type with
5000 to 30000 data pairs. I was trying to use "InputFile.getline(line,
81)", but when I use it in the following while loop, I get runtime
exception errors that look like language exceptions:
while( ! InputFile.eof ( ))
{
InputFile.getline(line, 81);
and more stuff;
}
Two additional notes: 1) I can continue to run the program after the
exception dialog is closed, and the output file appears fine, and 2) If
I replace the while loop with a for loop, I don't get exceptions.
However, I'd rather use the while loop (much neater for my application)
Any help would be appreciated.
Thanks in advance.