const char* filename1 = "myfile";
ifstream ifile(filename1);
string filename2 = filename1 + ".out"
ofstream ofile(filename2); // new output file
ofstream ofile(filename2, ios_base::app); // append
// Read something from the file:
double a; int b; char c[200];
ifile >> a >> b >> c; // skips white space in between
// Can test on success of reading:
if (!(ifile >> a >> b >> c)) ok = 0;