FS_ReadFileAsync

C Specification

#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 Byte length of data being read

Return Values

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

Description

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


Unlike the FS_ReadFile function, this function returns the control immediately and starts the asynchronous execution.
To verify the process is complete, periodically check the return value using FS_IsBusy or set the thread to wait status with FS_WaitAsync . When using the ROM Archive to read Game Card data, also refer to the description for the CARD_ReadRomAsync function.

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.

See Also

FSFile, FS_WaitAsync, FS_GetLength, FS_GetPosition, FS_SeekFile, FS_SeekFileToBegin, FS_SeekFileToEnd

Revision History

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