nn::fs::CreateFile Function

Syntax

void CreateFile(
     const wchar_t * pathName,
     s64 size
);

void CreateFile(
     const char * pathName,
     s64 size
);

List of Overloaded Member Functions

CreateFile ( const wchar_t *, s64 ) Creates a file.
CreateFile ( const char *, s64 ) Creates a file.

Description of CreateFile(const wchar_t *, s64)

This function is implemented to show an error screen when errors occur internally, whether or not such errors are fatal. Control does not return from the function in this case. Use nn::fs::TryCreateFile on everything other than ROM archives.

To read details about error handling, see Handling Errors During File and Directory Operations.

Note

After the size has been extended with this function, if nothing has been written to that region, then in principle the process of reading that region will return nn::fs::ResultVerificationFailed. However, if this function is called for save data or expanded save data, then the first 512 bytes (or the entire file if the size is 512 bytes or smaller) are guaranteed to be zero-initialized. By using this and writing to the file in the order (Create file > Write data and flush > Write file signature to front and flush), you can check that the file signature has been loaded correctly and guarantee that the file is written correctly.

Description of CreateFile ( const char *, s64 )


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 is implemented to show an error screen when errors occur internally, whether or not such errors are fatal. Control does not return from the function in this case. Use nn::fs::TryCreateFile on everything other than ROM archives.

To read details about error handling, see Handling Errors During File and Directory Operations.

Note

After the size has been extended with this function, if nothing has been written to that region, then in principle the process of reading that region will return nn::fs::ResultVerificationFailed. However, if this function is called for save data or expanded save data, then the first 512 bytes (or the entire file if the size is 512 bytes or smaller) are guaranteed to be zero-initialized. By using this and writing to the file in the order (Create file > Write data and flush > Write file signature to front and flush), you can check that the file signature has been loaded correctly and guarantee that the file is written correctly.

CONFIDENTIAL