TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: FRANK MASINGILL
from: DEVIN CARLEN
date: 1997-05-26 20:51:00
subject: getline?

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.