Sign in Join
FPDoc Onlineexperiment

GetFileAsString function

In unit sysutils

Return the contents of a file as a string.

Declaration

pascal
function GetFileAsString(const aFileName: RawByteString): RawByteString

Description

GetFileAsString returns the contents of aFileName or aHandle as a string. You can specify the string encoding in the aEncoding argument. If no encoding is specified SystemEncoding is used. The whole file is read in the case of aHandle: The file position is first set to offset zero.

Errors

If an invalid file handle or a file handle that does not support the seek operation, a EInOutError exception is raised.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.