FM> Instead of the expected result of the second file reading in the two
li
FM> as separate lines it is being read in as merged into one line. What am I
FM> doing wrong?
It's not. (See the correction below)
FM> #include
FM> void main()
FM> {
FM> const int MAX = 80;
FM> char buffer[MAX];
FM> ifstream InFile("MYTEST.DAT");
FM> while (InFile)
FM> {
FM> InFile.getline(buffer, MAX);
FM> cout << buffer;
cout << endl;
FM> }
FM> }
getline() gets up to MAX characters or until it hits a newline character.
the newline character is _not_ placed into the buffer. your program is
not merging the two lines, it just writes them on the same line.
--- GEcho 1.00
---------------
* Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350)
|