# NNS_McsReadFile

## Syntax

      #include <nnsys/mcs.h>

      u32 NNS_McsReadFile(
              NNSMcsFile* pFile,
              void*       buffer,
              u32         length,
              u32*        pReadBytes);

## Arguments

pFile | Pointer to the file information structure.
buffer | Pointer to the buffer. If the read is successful, the loaded content is stored in this buffer.
length | Number of bytes to read.
pReadBytes | Pointer to the variable. If the read is successful, the number of bytes that were actually loaded gets stored in this variable.

## Return Values

Returns 0 if the data is successfully read from the file. A nonzero value is returned if the read process failed. See Description for details on the possible return values.

## Description

Reads data from a file on a PC.

The return value takes one of the following values.

`NNS_MCS_FILEIO_ERROR_SUCCESS` (0) | The function was successful.
NNS_MCS_FILEIO_ERROR_COMERROR | A communications error occurred.
NNS_MCS_FILEIO_ERROR_NOTCONNECT | Not connected to the MCS server.
NNS_MCS_FILEIO_ERROR_SERVERERROR | A error has occurred due to a file operation on the MCS server side. The error code is a Win32 system error code that can be obtained using the `NNS_McsGetServerErrorCode` function.

## See Also

`NNS_McsOpenFile, NNS_McsWriteFile, NNS_McsCloseFile`

## Revision History

2005/01/24 Added the description regarding the error code
2004/07/01 Initial version.

CONFIDENTIAL