#include <nnsys/mcs.h>
u32 NNS_McsOpenFile(
NNSMcsFile* pFile,
const char* fileName,
u32 openFlag);
| pFile | Pointer to the file information structure. |
| fileName | Specifies the pointer to the character string that ends with NULL and indicates an open file or a newly-created file. If NULL is specified, a dialog window displays on the PC for selecting a file. |
| openFlag | How to open file or create file, and type of read or write (details explained above). |
0 if the file opened successfully. A non-zero value otherwise. The return value is one of the following:
Opens an existing file on the PC, or creates a new file and opens it.
openFlag specifies the method to use to open the file.
| NNS_MCS_FILEIO_FLAG_READ | Open an existing file for reading. |
| NNS_MCS_FILEIO_FLAG_WRITE | Create a new file for writing and open the file. If the file already exists, it is first deleted. |
| NNS_MCS_FILEIO_FLAG_FORCE | If NNS_MCS_FILEIO_FLAG_WRITE is specified and a file already exists, the user is not prompted about overwriting the file. If this flag is not specified and a file already exists, a dialog opens on the PC prompting the user to confirm that the file is to be overwritten. |
| NNS_MCS_FILEIO_FLAG_INCENVVAR | Specify this flag if a PC environment variable is included in the file name character string specified by fileName. The environment variable is enclosed by "%" characters, for example %NITROSYSTEM_ROOT%\SourceTreeMap.txt. |
| NNS_MCS_FILEIO_FLAG_CREATEDIR | When you specify NNS_MCS_FILEIO_FLAG_WRITE and create a file specified by fileName, if the directory in which the file is supposed to reside does not exist, this will create the directory. However, if NNS_MCS_FILEIO_FLAG_INCENVVAR has been specified and the PC environment variable contained in the file name character string specified by fileName does not exist, the function will fail without creating a directory. |
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. |
NNS_McsReadFile, NNS_McsWriteFile, NNS_McsCloseFile
01/24/2005 Added the description regarding the error code.
10/18/2004 Added a description of the flag NNS_MCS_FILEIO_FLAG_INCENVVAR.
07/01/2004 Initial version.