> FM>void main()
> Frank, please use int main(void) !!!!
Thanks, Cliff, I will. But WHY do the books I'm following not use it?
They are some of the most promient names like Lafore, etc. I'm not implying
that means they are right - just asking why you make a point of it?
> FM> InFile.getline(buffer, MAX);
> FM> cout << buffer;
> FM> Instead of the expected result of the second file
> FM>reading in the two lines as separate lines it is being read
> FM>in as merged into one line. What am I doing wrong?
> getline() removes the '\n' at the end of the line--it doesn't
> store it
> in buffer. So, when you display buffer you don't get the
> newline.
> Use cout << buffer << '\n';
O.K. I was following Lafore _Object Oriented Programming in Turbo C++_,
Chapter 14, page 523 and he said the getline function read the characters UP
TO the newline character and failed to say it "removes it" I added the code
you instructed and, of course, it worked - and I learned something.
Thanks "teach" (grin)
Sincerely,
Frank
--- FMail/386 1.02
---------------
* Origin: Maybe in 5,000 years frankmas@juno.com (1:396/45.12)
|