[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'FileUtil' (#lazutils)

ReadFileToString

ReadFileToString - returns a string with the contents of the named file.

Declaration

Source position: fileutil.pas line 70

function ReadFileToString(

  const Filename: string

):string;

Arguments

Filename

  

The name of the file for processing.

Function result

The contents of the file as a string, or an empty string if there is an error or the file is empty.

Description

ReadFileToString opens the file and reads its contents into a Stream, then reads the stream to construct the Result string.

Errors

If there is an error while reading the file, an Exception is raised and an empty string is returned.


Version 3.2 Generated 2024-02-25 Home