# FS_WriteFile

## C Specification

      #include <nitro/fs.h>

      s32 FS_WriteFile(
          FSFile*     p_file,
          const void  *src,
          s32         len);

## Description

This function 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.

Depending on the implementation of the archive, the size may be expanded automatically.

## Caution

This function cannot be called from the interrupt handler (IRQ mode). Note that the process may not be completed if the interrupts are prohibited.

## Arguments

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

## Return Values

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

## See Also

`FSFile`, `FS_OpenFile`, `FS_OpenFileFast`, `FS_CloseFile`, FS_GetLength, `FS_SeekFile`, `FS_SeekFileToBegin`, `FS_SeekFileToEnd`

## Revision History

09/24/2004 Added the description in the Caution section regarding the conditions for calling this function.
07/13/2004 Initial version