# FS_ReadFileAsync

## Syntax

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

## Arguments

p_file | Address of the `FSFile` structure.
dst | Address of the storage destination buffer.
len | Length of data being read, in bytes.

## Return Values

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

## Description

This function asynchronously reads a specified amount of data from current position of the file pointer. If the specified amount of data extends beyond the end of the file, the function reads to the end of the file and returns that as the size.
Unlike `FS_ReadFile()`, this function returns control immediately and starts asynchronous execution.
To confirm process completion, periodically check the return value with the `FS_IsBusy` function, or set the thread to wait status with the `FS_WaitAsync` function. If you are using the `ROM archive` to read Game Card data, also see the description for the `CARD_ReadRomAsync` function.

## Note

If the archive cannot run the process asynchronously, this function becomes a synchronous process, just like `FS_ReadFile`. 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_ReadFile
FS_WaitAsync
FS_GetFileLength
FS_GetFilePosition
FS_SeekFile
FS_SeekFileToBegin
FS_SeekFileToEnd`

## Revision History

2008/10/02 Updated the access list.
2005/08/28 Added link to the `CARD_ReadRomAsync` function in the Description section.
2004/09/24 Added the description in the Caution section regarding the conditions for calling this function.
2004/07/13 Revised description to that of the general archive.
2004/05/14 Initial version.

CONFIDENTIAL