This function loads a file from a path and returns a stream.
Name | Descriptio |
---|---|
path | file name or URL to load |
packages | set to true if packages should be read |
Returns a new Stream object If the file was successfully read, otherwise NULL is returned.
#include "UltraEngine.h"
using namespace UltraEngine;
int main(int argc, const char* argv[])
{
WString path = GetPath(PATH_DOCUMENTS) + "/temp.txt";
//Write a new file
auto stream = WriteFile(path);
if (stream == NULL)
{
Print("Failed to write file.");
return 0;
}
stream->WriteLine("Hello, world!");
stream->Close();
stream = ReadFile(path);
Print(stream->ReadLine());
return 0;
}