Sign in Join
FPDoc Onlineexperiment

TTarArchive.ReadFile procedure

Member of TTarArchivepublicIn unit LibTar

Read a file from the archive.

Declaration

pascal
procedure ReadFile(Buffer: POINTER); overload
procedure ReadFile(Stream: TStream); overload
procedure ReadFile(const Filename: AnsiString); overload
function ReadFile: RawByteString; overload

Arguments

Buffer

Memory buffer to copy file contents to.

Stream

Stream to copy file contents to.

Filename

Filename for file in which to write file content.

Function result

File contents as string.

Description

ReadFile can be used to read the current file in the archive. It can be called after the archive was successfully positioned on an entry in the archive. The file can be read in various ways:

  • directly in a memory buffer. No checks are performed to see whether the buffer points to enough memory.
  • It can be copied to a Stream.
  • It can be copied to a file with name FileName.
  • The file content can be copied to a string

Errors

An exception may occur if the buffer is not large enough, or when the file specified in filename cannot be opened.

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