out_stream.open("C:\\Documents and Settings\\Administrator\\Desktop\\HW\\HW4\\hw4pr5input.txt", ios::in | ios::out);
if (in_stream.fail())
{
cout << "Input file opening failed.\n";
system ("pause");
exit(1);
}
out_stream.open("C:\\Documents and Settings\\Administrator\\Desktop\\HW\\HW4\\hw4pr5input_output.txt");
if (out_stream.fail())
{
cout << "Output file opening failed.\n";
system ("pause");
exit(1);
}
cout << "enter programming advice now, press enter twice:" << endl;
while ( getline (out_stream,line) )
{
cout << line << endl;
}
cout << "Write a piece another piece of advice. Press the Enter key twice:" " ";
this is a beginner forum correct? thanks. used the term hyperlink to refer to pathway. so what do you mean by only default constructed it? why are people so hypersensitive to a beginner
Default construction means creating an object without parameters, like ifstream in_stream;.
Sorry if I sounded stingy or something. I wrote the way I did (specifically "This ain't HTML") as a play on some old thread that I now feel like a donkey's butt about.
File I/O isn't my strong point, but I am pretty sure you need to close your files before opening a new one with the same object, namely, after your first if statement.