Output file is missing

  • Thread starter Thread starter GerryWolff
  • Start date Start date
G

GerryWolff

Guest
The following code, extracted from a larger program, seems to work correctly. But there is no sign of the output file anywhere.

Can anyone see what needs to be changed to cure this problem?

C++ PROGRAM:

char *in_filename ;
char *out_filename ;

// The in_filename and the out_filename have the command arguments as their values:
// "C:\Storage\JGW\Research\Dev\2018plus\LANGS\LANG1\LANG1\Debug\in\gr1.txt"
// "C:\Storage\JGW\Research\Dev\2018plus\LANGS\LANG1\LANG1\Debug\out\o_gr1.txt"

ifstream ifile("in_filename",ios::ate); // Leaving off the quote marks leads to an assertion failure.

// The input part of the larger program seems to work correctly.
// But there is no sign of the output file anywhere when the program exits.

ofstream ofile("out_filename",ios::ate); // Leaving off the quote marks leads to an assertion failure.

ofile.open(out_filename) ;
if(ofile.is_open() == false)
abort_run("Unable to open output file.\n") ;

// Test message

ofile << "Test message." ;
ofile.close();
exit(0) ;




GerryWolff

Continue reading...
 
Back
Top