CNTRead

Syntax


#include <revolution/cnt.h>

s32 CNTRead(CNTFileInfo* cf, void* addr, u32 length);

Arguments

cf Pointer to the CNTFileInfo structure.
addr Pointer to the write destination for the data that was loaded. The write buffer must be 32-byte aligned.
length Number of bytes to load. Must be a multiple of 32.

Return Values

Returns the size (in bytes) loaded when the process completes normally. Returns one of the following codes when the process fails.

CNT_RESULT_AUTHENTICATION
CNT_RESULT_CORRUPT
CNT_RESULT_ECC_CRIT
CNT_RESULT_INVALD
CNT_RESULT_OUT_OF_MEMORY
CNT_RESULT_UNKNOWN
CNT_RESULT_FATAL

If a fatal error occurs during loading when a disc application is being executed, the function will return CNT_RESULT_READ_ERR. If the load is canceled, the function returns CNT_RESULT_DVD_CANCELED.

Description

Reads and loads the files in the content file. After reading the files, the file access position moves by the amount of data read.

Note: This function may put the current thread to sleep. Refer to Interrupts and Callback Functions.

Note

The end of the archive file is not 32-byte aligned. For this reason, the return value for optical disc applications is the 32-byte aligned value specified for loading, while the return value for NAND applications is the actual length of the load (that is, a value that is not 32-byte aligned). Be aware that the values will be different because of this.

See Also

CNTOpen, CNTSeek, CNTTell, CNTReadWithOffset
Interrupts and Callback Functions

Revision History

2008/01/11 Changed the specifications of CNTRead.
2007/11/20 Added information about the result code used with disc applications. Standardized the use of the term "content file".
2007/09/12 Added information about the sleep status of threads.
2006/12/04 Added result code descriptions.
2006/09/20 Added a description about the restrictions when specifying offset.
2006/09/08 Revised the description of the offset argument, which was insufficient.
2006/08/15 Initial version.


CONFIDENTIAL