$fread function


The $fread function reads and returns the (text) contents of the file path. If path does not refer to a file, or the file cannot be read, or the file is empty, the result is an empty string.

Note: The amount of text that is returned is typically limited to the first 1-2 KB of the file contents, depending on the context in which the $fread function is used.


All parameters may contain symbolic references; these are resolved before the function is applied. See Examples below.

File path from which to read the contents.
[Optional] The Windows code page to use when reading the file contents. The code page must be specified as a decimal or hexadecimal number; hexadecimal numbers must be prefixed with 0x as per C-style convention. If omitted, code page 0 (CP_ACP, the current ANSI code page for the user) is used. Other common code pages include 1 (CP_OEMCP, the current OEM code page), 1200 (the Unicode UTF-16 Little Endian code page), 1252 (the Western European code page), and 65001 (the Unicode UTF-8 code page). For a full list, see Code Page Identifiers on the MSDN website.


Here are some usage examples for this function:

<$fread(C:\Program Files\InstallMate\Readme.txt)>
Returns the contents of the Readme.txt file, if present.