ReadString()

Syntax

Text$ = ReadString(#File [, Flags [, Length]])
Description
Read a string from a file until an 'End Of Line' character is found (Unix, DOS and Macintosh file formats are supported).

Parameters

#File The file to read from.
Flags (optional) The flags to apply while reading the string. It may be one of the following values:
  #PB_Ascii  : reads the string as ASCII, even when the program is compiled in unicode mode
  #PB_UTF8   : reads the string as UTF8
  #PB_Unicode: reads the string as UTF16
combined with:
  #PB_File_IgnoreEOL: ignores the end of line (but the resulting string will still contain them) until the specified
                      length or the end of file.
Length (optional) Read the file until the length (in characters) have been reached. If an end of line is encountered before the length is reached, the read will stop (unless the flag #PB_File_IgnoreEOL has been set).

Return value

Returns the read string, or an empty string if the read has failed.

Remarks

For detecting the string encoding format (byte order mark) used in a file there is the ReadStringFormat() function available.

For an example see the ReadFile().

See Also

WriteString(), ReadStringFormat(), OpenFile(), ReadFile()

Supported OS

All

<- ReadQuad() - File Index - ReadStringFormat() ->