# fsIOWrite The **fsIOWrite** function is used to open a file and write data to it. Note that you can only write to files that have been saved to the `/work/` folder (see here for details: [Inaccessible Files](io-api/#inaccessible)).   ##### Syntax ``` wasm FsIOErr fsIOWrite( FsIOFile file, const char* pInBuffer, int byteOffset, int byteToWrite, FsIOFileWriteCallback callback, void* pUserData ); ```   ##### Members {{< table-wrapper >}} | Parameters | Description | |---------------|---------------------------------------------------------------------------------------------------------------------------------------------------| | `file` | This is the ID of a previously opened file, as returned by the `fsIOOpen` function. | | `pInBuffer` | This is a previously created buffer that contains the data to be written. The buffer should be at least of the size `byteToWrite` - `byteOffset`. | | `byteOffset` | This is the offset into the file to which data will be written. | | `byteToWrite` | This defines the number of bytes to write to the file. | | `callback` | Callback (`FsIOFileWriteCallback`) that is sent when the write operation is finished. | | `pUserData` | Pointer given to the callback to identify the function call. | {{< /table-wrapper >}}   ##### Return Values The function returns one of the `FsIOErr` codes.   ##### Remarks This function is non-blocking: it will not wait for the file to be read to pass to the next line of code.