# FS_ReadFileAsync

## C Specification

      #include <nitro/fs.h>

      s32 FS_ReadFileAsync(
          FSFile  *p_file,
          void    *dst,
          s32     len);

## Description

This function asynchronously reads a specified amount of data from the file pointer's current position. If the specified size exceeds the end of the file, it will read to the end and return that size.

This function is not the same as the `FS_ReadFile` function. It immediately returns control and is executed asynchronously. Use the `FS_IsBusy` function to confirm the completion of the process. You can use the `FS_WaitAsync` function to wait until processing is complete.

## Caution

If the archive cannot execute the process asynchronously, this function becomes a synchronous process, just like `FS_ReadFile`.

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

## Arguments

`p_file` | `FSFile` structure's address
`dst` | Address of the storage destination buffer
`len` | Length of the data to read in bytes

## Return Values

If the data is read correctly, it returns the number of bytes. Otherwise it returns a value of `-1`.

## See Also

`FSFile, FS_WaitAsync, FS_GetLength, FS_GetPosition, 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 Revised description to indicate that it is with the entire archive.
05/14/2004 Initial version.