# FS_WriteFileAsync

## Syntax

  `#include <nitro/fs.h>`
  `s32 FS_WriteFileAsync(FSFile* p_file, const void *src, s32 len);`

## Arguments

p_file | Address of the `FSFile` structure.
src | Address of the buffer that stores the write data.
len | Byte length of data to be written.

## Return Values

Returns the number of bytes if the data can be written properly. If not, returns `-1`.

## Description

This function asynchronously writes data of the specified size beginning at the current location of the file pointer. When the specified size is greater than the available memory, data is written until the available memory is used up. The size of the written data is returned. Unlike the `FS_WriteFile` function, it returns the control immediately and starts the asynchronous execution. Use the `FS_IsBusy` function to confirm the completion of the process. Alternatively, use the `FS_WaitAsync` function to wait for the completion.

## Note

If the archive cannot run the process asynchronously, this function becomes a synchronous process, just like `FS_ReadFile`. For such archives, this function cannot be called from the interrupt handler (IRQ mode). The process may not be completed if interrupts are prohibited.

## See Also

`FSFile
FS_WriteFile
FS_IsBusy
FS_WaitAsync
FS_GetFileLength
FS_GetFilePosition
FS_SeekFile
FS_SeekFileToBegin
FS_SeekFileToEnd`

## Revision History

2008/10/02 Updated the See Also list.
2004/11/02 Corrected argument description.
2004/09/24 Added text under Note regarding the conditions for calling this function.
2004/07/13 Initial version.

CONFIDENTIAL