C4 Engine
C4 Engine API Documentation

File::OpenFile

Defined in:  C4Files.h
Opens a file.
Prototype

FileResult OpenFile(const char *name, FileOpenMode mode = kFileReadOnly);

Parameters
name A pointer to the name of the file. If a path name is specified, it is interpreted relative to the application. Directory names preceding a file name or another directory name should be followed by a single forward slash character (/).
mode Specifies how the file should be opened.
Description
The OpenFile function opens the file specified by the name parameter. The mode parameter specifies one of the following open modes.
kFileReadOnly The file is to be opened with read-only access.
kFileReadWrite The file is to be opened with read/write access.
kFileCreate A new file is to be created and opened with read/write access. Any existing file with the same name will be overwritten.
If the open operation succeeeds, then the return value is kFileOkay. Otherwise, one of the following file result codes is returned.
kFileOpenFailed The file could not be opened because the operating system returned an error.
kFileCreateFailed The file could not be created because the operating system returned an error.
See Also

File::CloseFile