Category : C Source Code
Archive   : C-ALL.ZIP
Filename : TI647.ASC

Output of file : TI647.ASC contained in archive : C-ALL.ZIP

PRODUCT : Borland C++ NUMBER : 647
DATE : September 11, 1991 PAGE : 1/1

TITLE : Correct Behavior for ins.getline()

"insp=&ins.get(ptr,sb,delim). Extracts characters and stores
them in the byte array beginning at ptr and extending for
len bytes. Extraction stops when delim is encountered
(delim is left in ins and not stored), when ins has no more
characters, or when the array has only one byte left. get
always stores a terminating null, even if it doesn't extract
any characters from ins because of its error status.
ios::failbit is set only if get encounters an end of file
before it stores any characters.

insp=&ins.getline(ptr,len,delim). Does the same thing as
ins.get(ptr,len,delim) with the exception that it extracts a
terminating delim character from ins. In case delim occurs
when exactly len characters have been extracted, termination
is treated as being due to the array being filled, and this
delim is left in ins."
pg. 4, AT&T C++ 2.0 Library Reference

As stated above, getline() is just like get() except that it
reads up to and including the delimiter but does not store the
delimiter in the buffer. get() reads up to but not including the
delim, so the delim is left unread in the stream. getline()
reads the delim and throws it away.

TC++ 1.00 has a problem in that getline() actually stores the
delimiter in the buffer; this behavior was a problem, not the
prescribed behavior for getline()!

  3 Responses to “Category : C Source Code
Archive   : C-ALL.ZIP
Filename : TI647.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: