OpenFile
This function opens a file with read and write access.
Syntax
- static Stream* OpenFile(const std::string& path)
Parameters
- path: the path to the file to open.
Returns
If the file is able to be opened, a new stream is returned, otherwise NULL is returned.
Remarks
This function will return NULL if Lua sandboxing is enabled.
Example
#include "Leadwerks.h"
using namespace Leadwerks;
int main(int argc, const char *argv[])
{
std::string path = "MyFile.txt";
Stream* stream = FileSystem::OpenFile(path);
if (stream)
{
stream->WriteLine("Hello!");
stream->Seek(0);
System::Print(stream->ReadLine());
stream->Release();
}
return 0;
}