R
RB
In using-> endl I read mixed information. Some say the only times
that flushing is an issue is when you are accessing files that have been
open awhile. In other words ( I read ) that cin and cout are tied together
and any request for input on cin will automatically flush cout. While
on files ( I read ) the stream implementation '\n' is interpreted correctly by
the stream class. If one checked the data that is stored in the file (read the
file in binary mode) one could see the conversion:
*nix: '\n'
MS-DOS/MS-Windows: '\r\n'
MAC: '\r'
In essence many said using '\n' is completely portable and always has been.
The c++ standards did not change that.
==============================================
However, I see no problem with using endl myself. My question is:
I surmise that I am "covered" in whatever theory if I do the \n" on all
lines except the last one for each cout ? As example:
cout << "First real looooooooooooooooooooooooooooooong line\n"
<< "second real looooooooooooooooooooooooooooong line\n"
<< "and finish with line" << endl;
that flushing is an issue is when you are accessing files that have been
open awhile. In other words ( I read ) that cin and cout are tied together
and any request for input on cin will automatically flush cout. While
on files ( I read ) the stream implementation '\n' is interpreted correctly by
the stream class. If one checked the data that is stored in the file (read the
file in binary mode) one could see the conversion:
*nix: '\n'
MS-DOS/MS-Windows: '\r\n'
MAC: '\r'
In essence many said using '\n' is completely portable and always has been.
The c++ standards did not change that.
==============================================
However, I see no problem with using endl myself. My question is:
I surmise that I am "covered" in whatever theory if I do the \n" on all
lines except the last one for each cout ? As example:
cout << "First real looooooooooooooooooooooooooooooong line\n"
<< "second real looooooooooooooooooooooooooooong line\n"
<< "and finish with line" << endl;