# FS_OpenFileExW

## Syntax

    #include <nitro/fs.h>

    BOOL FS_OpenFileEx(FSFile *file, const char *path, u32 mode);
    BOOL FS_OpenFileExW(FSFile *file, const u16 *path, u32 mode);

## Arguments

`file` | FSFile structure where the handle should be stored.
`path` | File's path.
`mode` | Specifies the combination of FS_FILEMODE_* flags that indicate the mode for accessing the file.

## Return Values

TRUE if the file handle opens properly; FALSE otherwise. In case of failure, use `FS_GetResultCode()` to get the error details.

## Description

Opens the handle for the specified file.
You can use the `FS_OpenFileEx` function when the path is specified using `Shift_JIS` and the `FS_OpenFileExW` function when the path is specified using `UTF16-LE`. The results that are obtained will be the same. There are several conditions that apply to files that can be opened.

- The file must already exist; it will not be created automatically, even if this function is called with FS_FILEMODE_W specified.`FS_CreateFile()` must be used to create a new file.
- In order to avoid unintentional malfunction due to the fact that the functions for file operations supported by the FS library only work for files under 2 GB, this function will always fail and return `FS_RESULT_PEMISSION_DENIED` if you try to open a file 2 GB or larger.
- If an attempt is made to open a TWL-only file while operating in NITRO mode, the function will fail and return `FS_RESULT_PEMISSION_DENIED`. (For more information on the specification of TWL-only files, see the explanation about the `Put` parameter in makerom.TWL.)

The various functions for file access can be called using the handle that is obtained. After using a handle, you must call `FS_CloseFile()` to free it.

## Note

- This function cannot be called from the interrupt handler (IRQ mode). Also, in some cases processing may not end if interrupts are left prohibited.

## See Also

`FSFile FSDirectoryEntryInfo
FS_ReadFile FS_WriteFile FS_SeekFile`

## Revision History

2009/01/08 Added an explanation about TWL-only files.
2008/09/02 Added notes concerning a Unicode version of the function.
2008/07/16 Revised the description to use FS_GetResultCode() for getting the error code in cases of failure. Added size restriction of 2 GB.
2008/06/10 Added the fact that files will not be created automatically.
2007/09/18 Initial version.

CONFIDENTIAL