Correct Behavior for ins.getline()








  PRODUCT  :  Borland C++                            NUMBER  :  647
  VERSION  :  2.0
       OS  :  PC DOS
     DATE  :  August 12, 1992                          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()!

  DISCLAIMER: You  have the right to use this technical information
  subject to the terms  of  the  No-Nonsense License Statement that
  you received with  the  Borland product to which this information
  pertains.

















Comments

Popular posts from this blog

BOTTOM LIVE script

Fawlty Towers script for "A Touch of Class"