fsIOOpenRead
The fsIOOpenRead function is used to open a file and read data from it.
Syntax
FsIOFile fsIOOpenRead(
const char* path,
FsIOOpenFlags flags,
char* outBuffer,
int byteOffset,
int byteToRead,
FsIOFileReadCallback callback,
void* pUserData
);
Members
Parameters | Description |
---|---|
path |
Path to the file being opened for reading. Files must exist within the package using the module to be able to be read, however please note that some files may be encrypted or inaccessible, as explained here: Inaccessible Files
You can use the following to target files from the package folder root or the persistent storage root:
|
flags |
This is a bit-flag defining how the file should be opened. Please see FsIOOpenFlags for details. |
outBuffer |
This is a pointer to a previously created buffer which will store the data being read. It needs to be allocated and must be large enough to contains the whole file or the byteToRead bytes (if not set to -1). |
byteOffset |
This is the offset into the file from which data will be read. If this is not null then byteToRead must not be set to -1. |
byteToRead |
This defines the number of bytes to read from the file. If set to -1, the entire file will be read. |
callback |
Callback (FsIOFileReadCallback ) that is sent when the open operation is finished. |
pUserData |
Pointer given to the callback to identify the function call. |
Return Values
An ID pointer representing the file being opened.
Remarks
This function is non-blocking: it will not wait for the file to be opened to pass to the next line of code. Errors can be checked for using the fsIOGetLastError
function.