# NNS_SndArcReadFile

## C Specification

      #include <nnsys/snd.h>

      s32 NNS_SndArcReadFile(
      u32 fileId,
      void* buffer,
      s32 size,
      s32 offset );

## Arguments

`fileId` | The file ID
`buffer` | The address of the storage destination buffer
`size` | The length in bytes of the retrieved data
`offset` | The position at which to begin loading relative to the start of the file

## Return Values

Returns the loaded data size. Returns a `-1` if the load fails.

## Description

Reads out the the file in the sound archive to memory.

Memory must be allocated in advance in `size` portions of the data size to load. Use the `NNS_SndArcGetFileSize` to get the file size.

The file ID `fileId` can be obtained from the sound data information structure obtained with the `NNS_SndArcGetSeqInfo` function.

This function is called from functions such as the `NNS_SndArcLoadSeq` function or the `NNS_SndArcLoadSeqArc` function.

### Note

Use this function only for the sound archive initialized with the `NNS_SndArcInit` function. This function cannot be used with the sound archive initialized with the `NNS_SndArcInitOnMemory` function.

## See Also

`NNS_SndArcGetFileSize, NNS_SndArcGetSeqInfo, NNS_SndArcLoadSeq, NNS_SndArcLoadSeqArc, NNS_SndArcInit, NNS_SndArcInitOnMemory`

## Revision History

06/01/2004 Initial version.