ReadFile

This function opens a file with read access.

Syntax

Parameters

Returns

If the file is able to be opened, a new stream is returned, otherwise NULL is returned.

Example

#include "Leadwerks.h"

using namespace Leadwerks;

int main(int argc, const char *argv[])
{
std::string path = "MyFile.txt";
Stream* stream = FileSystem::WriteFile(path);

if (stream)
{
stream->WriteLine("Hello!");
stream->Release();
}

stream = FileSystem::ReadFile(path);
if (stream)
{
System::Print(stream->ReadLine());
stream->Release();
}

return 0;
}