Sign in Join
FPDoc Onlineexperiment

LoadStringFromFile function

In unit LazStringUtils

Reads a string with the contents of the specified file name.

Declaration

pascal
function LoadStringFromFile(const aFileName: string): string

Description

LoadStringFromFile creates a TFileStream instance used to load the values from the file name in AFileName. The stream is created with the fmOpenREad file mode, and its Read method is called to read the contents of the entire file stream.

The return values is a String type with the values read from the stream, and its size matches the size of the file stream. If the file stream has no content, the return value is an empty string ('').

Use SaveStringToFile to store a string to a specified file name.

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.