Logo Search packages:      
Sourcecode: pwlib version File versions

void PString::ReadFrom ( istream &  strm  )  [virtual, inherited]

Input the string from the specified stream. This will read all characters until a end of line is reached. The end of line itself is { not} placed in the string, however it { is} removed from the stream.

Parameters:
strm  I/O stream to input from.

Definition at line 1560 of file contain.cxx.

References PString::MakeMinimumSize(), and PString::SetSize().

{
  SetMinSize(100);
  char * ptr = theArray;
  PINDEX len = 0;
  int c;
  while ((c = strm.get()) != EOF && c != '\n') {
    *ptr++ = (char)c;
    len++;
    if (len >= GetSize()) {
      SetSize(len + 100);
      ptr = theArray + len;
    }
  }
  *ptr = '\0';
  if ((len > 0) && (ptr[-1] == '\r'))
    ptr[-1] = '\0';
  PAssert(MakeMinimumSize(), POutOfMemory);
}


Generated by  Doxygen 1.6.0   Back to index