# NNS_SndArcReadFile

## Syntax

      #include <nnsys/snd.h>

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

## Arguments

`fileId` | File ID.
`buffer` | Address of the storage destination buffer.
`size` | Length (in bytes) of the data to read out.
`offset` | Position, relative to the start of the file, at which to begin loading.

## Return Values

Returns size of the loaded data. Returns -1 if the load fails.

## Description

Reads into memory the file in sound archive.

A portion of memory equal to `size` (the amount of data to load) must be allocated in advance. Use `NNS_SndArcGetFileSize` to get the file size.

The file ID `fileId` can be obtained from the sound data information structure gotten with ``NNS_SndArcGetSeqInfo`` or similar functions.

If you wish to limit the size of data that can be loaded at one time, use the `NNS_SndArcSetLoadBlockSize` function to specify the load block size.

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

### Note

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

## See Also

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

## Revision History

2007/10/17 Added descriptions related to the `NNS_SndArcSetLoadBlockSize` function.
2004/06/01 Initial version.

CONFIDENTIAL