VFReadFile

C Specification


#include <revolution/vf.h>

typedef void	VFFile;
typedef s32	VFErr;

VFErr VFReadFile( VFFile* file, void* buf, u32 size, u32* read_file );

Arguments

file A pointer to the file descriptor.
buf A pointer to the storage region for reading data.
size Number of bytes to read.
read_size The number of read bytes (specify NULL if not needed).

Return Values

Returns 0 when successful
Otherwise, returns VFErr other than 0

Description

Reads data from an open file. When a size that goes beyond the end of the file is specified, the read occurs up to the file's end.
When file data is read, the file data I/O pointer moves by the size (in bytes) that is actually read.
Furthermore, the I/O pointer for the read file data can be changed with VFSeekFile.
When the I/O pointer is at the end of the file, a read size of 0 is returned, indicating success.
An error (VF_ERR_ENOEXEC) is returned when the I/O pointer attempts to read from a point beyond the file's end.

Note: Operations cannot be guaranteed if you have specified access to an invalid region because an address check for buf (the pointer to the buffer) is not performed if the pointer is not a NULL pointer.
Data sizes larger than 4 GB cannot be read. In that case, only the first 4 GB of data will be read.

See Also

VFCreateFile, VFOpenFile, VFSeekFile, VFWriteFile, VFCloseFile, VFDeleteFile

Revision History

2006/06/09
2007/05/08 Corrected errors.


CONFIDENTIAL