fsIOOpen

The fsIOOpen function is used to open a file for reading/writing/editing.

 

Syntax
FsIOFile fsIOOpen(
    char* path,
    FsIOOpenFlags flags,
    FsIOFileOpenCallback callback,
    void* pUserData
);

 

Members
Parameters Description
path

Path to the file being opened. 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:

 

  1. ./ - to access the files from within the add-on package, eg:
    ./data/pi.txt
    The above path will look for the pi.txt file in the data folder from the package root in the VFS.

 

  1. /work/ - to access a persistent storage that the add-on can use, eg:
    /work/pi.txt
    The path above will look in the persistent storage folder for the pi.txt file. This file is located here:
    %appdata%/Microsoft Flight Simulator/WASM/MSFS2020/PackageName/work
flags This is a bit-flag defining how the file should be opened. Please see FsIOOpenFlags for details.
callback Callback (FsIOFileOpenCallback) 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.