#include <cafe/fs.h> FSStatus FSReadFileWithPos( FSClient *client, FSCmdBlock *block, void *dest, FSSize size, FSCount count, FSFilePosition fpos, FSFileHandle fileHandle, FSFlag flag, FSRetFlag errHandling ); FSStatus FSReadFileWithPosAsync( FSClient *client, FSCmdBlock *block, void *dest, FSSize size, FSCount count, FSFilePosition fpos, FSFileHandle fileHandle, FSFlag flag, FSRetFlag errHandling, const FSAsyncParams *asyncParams );
|client||Pointer to the client buffer.|
|dest||Pointer to data array to read into. This must be aligned properly. See description.|
|size||Size of one array member [bytes].|
|count||Number of array members to read.|
|fpos||Stating file position.|
|fileHandle||Handle of the file to read from.|
|flag||Bitfield of flag values. No effective flag is defined yet.|
|errHandling||Auto error handling flag. Only indicated errors are returned.|
|asyncParams||(Async API only) Notification parameters for an asynchronous call.|
|Non-negative value ( ≥ 0 )||Number of elements read.|
||The command was canceled.|
||Access mode is invalid (e.g. Opened file is not readable mode).|
||(Only for manually mounted devices) Media is not present.|
||(Only for manually mounted devices) Media is in some inaccessible condition.|
||(Only for manually mounted devices) The data is corrupted beyond repair. The volume needs format.|
||Successfully issued request.|
||The argument is invalid.|
Reads data from the file stream designated by fileHandle into the data array designated by dest, specifying the starting file position designated by fpos. The file position of the stream is advanced from the specified file position by the number of characters read. If an error occurs, the file position is indeterminate. If a partial element is read, its value is indeterminate.
If size or count is zero, this function returns zero (=
FS_STATUS_OK) without reading anything, but it will be followed by physical
seek motion on the device to the requested location if the device supports it (e.g. optical disc drive moving the pickup head).
NULL can be specified
to dest if and only if size or count is zero.
Alignment of the address and size of data buffer are constrained by
FS_IO_BUFFER_ALIGN as same as
For good performance, allocate the dest buffer on the heap.
Large file read transaction will be automatically paused when a command with higher priority is queued to the same client.
Both a sync and async style API are provided. To use the async API, set the user callback and parameters in asyncParams.
For more information, see
|Thread that displays graphics||Do not call this function from a thread that displays graphics. This function may block indefinitely in error cases and the application must be able to display appropriate messages.|
|Thread that handles system messages||Do not call this function from a thread that handles system messages. This function may block indefinitely in error cases and the application must be able to handle system events such as shutdown.|
|Callbacks||Do not call this function from any callback function.|
|Interrupt handler||Do not call this function from any interrupt handler.|
|Exception handler||Do not call this function from any exception handler.|
2014/09/16 Added "Thread that displays graphics" and "Thread that handles system messages" to "Do not call from".
2013/05/23 Added FS_STATUS_DATA_CORRUPTED to return values.
2013/05/20 Added FS_STATUS_MEDIA_NOT_READY to return values.
2013/05/08 Automated cleanup pass.
2013/01/19 Added description that
NULL can be specified to dest if and only if size or count is zero.
2013/01/10 Added "Do not call from".
2012/07/20 Readability and correctness cleanup.
2012/02/20 Initial version.
2011/07/31 Noted about command priority.
2010/03/30 Fixed type name FSNotificationParams ->