nn::fs::FileOutputStream::TryInitialize Member Function

Syntax

nn::Result TryInitialize(
     const wchar_t * pathName,
     bool createIfNotExist
);

nn::Result TryInitialize(
     const char * pathName,
     bool createIfNotExist
);

List of Overloaded Member Functions

TryInitialize(const wchar_t *, bool) Opens the specified file.
TryInitialize(const char *, bool) Opens the specified file.

Description of TryInitialize(const wchar_t *, bool)

Opens the file in the specified path with write-only access and enables writing. If the createIfNotExist argument has been set to true and no file exists in the specified path, this function creates the file and opens it write-only. You cannot call this function if this object already has a file open.

This function returns any error that occurs while it is opening the file.

Important

For expanded save data, you must explicitly create a file using the nn::fs::TryCreateFile function before calling this function. Note: Specifying createIfNotExist=true for expanded save data will cause an error. See Archives for details about expanded save data.

Description of TryInitialize(const char *, bool)

Opens the file in the specified path with write-only access and enables writing. If the createIfNotExist argument has been set to true and no file exists in the specified path, this function creates the file and opens it write-only.


Note: This function uses a large amount of buffer space on the stack because it converts the path name from a multibyte character string into a wide character string. Pay careful attention to the stack size.

This function returns any error that occurs while it is opening the file.

Important

For expanded save data, you must explicitly create a file using the nn::fs::TryCreateFile function before calling this function. Note: Specifying createIfNotExist=true for expanded save data will cause an error. See Archives for details about expanded save data.

CONFIDENTIAL