Frank Masingill had the nerve to say the following to All:
FM> What is wrong with my code below:
FM> Program to send text to a file:
FM> while (InFile)
FM> {
FM> InFile.getline(buffer, MAX);
FM> cout << buffer;
FM> }
FM> }
FM> Instead of the expected result of the second file reading in
FM> the two lines as separate lines it is being read in as merged into
FM> one line. What am I doing wrong?
getline() will read upto the '\n' but not actually place it in the string.
Changing the line:
cout << buffer;
to
cout << buffer << endl;
will place the appropriate newline at the end of the string.
Devin Carlen
: devin@maxvision.com
: http://ro.com/~carlen
--- timEd 1.10+
---------------
* Origin: Terminal Velocity - (205)883-6070 - USR v.34 (1:373/29)
|