[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'libtar' (#fcl)

# TTarArchive.ReadFile

Read a file from the archive

## Declaration

Source position: line 0

`public procedure TTarArchive.ReadFile(`
`Buffer: POINTER`
`); overload; procedure TTarArchive.ReadFile(`
`Stream: TStream`
`); overload; procedure TTarArchive.ReadFile(`
`Filename: String`
`); overload; function TTarArchive.ReadFile: String; overload;`

## Arguments

`Buffer` |  | Memory buffer to copy file contents to.

## Arguments

`Stream` |  | Stream to copy file contents to.

## Arguments

`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 succesfully 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.

The latest version of this document can be found at lazarus-ccr.sourceforge.net .