# NNS_McsWriteFile

## Syntax

      #include <nnsys/mcs.h>

      u32 NNS_McsWriteFile(
              NNSMcsFile* pFile,
              const void* buffer,
              u32         length);

## Arguments

pFile | Pointer to the file information structure.
buffer | Pointer to the buffer holding the data for writing.
length | Number of bytes to write.

## Return Values

0 if data are written to the file successfully, a non-zero value if it failed. See Description for details on the possible return values.

## Description

This function writes data to a file on the 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_McsReadFile, NNS_McsCloseFile`

## Revision History

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

CONFIDENTIAL