Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

BOOL PTextFile::ReadLine ( PString str )

Read a line from the text file. What constitutes an end of line in the file is platform dependent.

Use the PChannel::GetLastError()# function to determine if there was some error other than end of file.

TRUE if successful, FALSE if at end of file or a read error.
strString into which line of text is read.

Definition at line 1161 of file ptlib.cxx.

References PString::MakeMinimumSize(), and PChannel::ReadChar().

Referenced by PFTPServer::SendToClient().

  char * ptr = str.GetPointer(100);
  PINDEX len = 0;
  int c;
  while ((c = ReadChar()) >= 0 && c != '\n') {
    *ptr++ = (char)c;
    if (++len >= str.GetSize())
      ptr = str.GetPointer(len + 100) + len;
  *ptr = '\0';
  PAssert(str.MakeMinimumSize(), POutOfMemory);
  return c >= 0 || len > 0;

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  Doxygen 1.6.0   Back to index