Lua
C++
Edit

ReadFile

This function loads a file from a path and returns a stream.

Syntax

Parameter Descriptio
path file name or URL to load
flags optional load settings

Returns

Returns a new Stream object If the file was successfully read, otherwise nil is returned.

Example

local path = GetPath(PATH_DOCUMENTS) .. "/temp.txt";

--Write a new file
local stream = WriteFile(path);
if stream == nil then
    Print("Failed to write file.");
    return
end

stream:WriteLine("Hello, world!");
stream:Close();

stream = ReadFile(path);
Print(stream:ReadLine());
Copyright © 2024 Ultra Software.
All rights reserved.