1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html xmlns="http://www.w3.org/1999/xhtml">
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
5<meta http-equiv="Content-Style-Type" content="text/css" />
6<title>FS_OpenFileExW</title>
7<link rel="stylesheet" href="../../css/nitro.css" type="text/css" />
8</head>
9<body>
10
11<h1>FS_OpenFileExW <img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></h1>
12<h2>Syntax</h2>
13<pre><code>
14#include &lt;nitro/fs.h&gt;
15
16BOOL FS_OpenFileEx(<a href="../fs_file_type.html">FSFile</a> *file, const char *path, u32 mode);
17BOOL FS_OpenFileExW(<a href="../fs_file_type.html">FSFile</a> *file, const u16 *path, u32 mode);
18</code></pre>
19
20<h2>Arguments</h2>
21<table style="width:100%">
22<tbody>
23<tr>
24<td style="width:13%"><CODE>file</CODE></td>
25<td style="width:87%"><a href="../fs_file_type.html">FSFile</a> structure where the handle should be stored.</td>
26</tr>
27<tr>
28<td style="width:13%"><CODE>path</CODE></td>
29<td style="width:87%">File's path.</td>
30</tr>
31<tr>
32<td style="width:13%"><CODE>mode</CODE></td>
33<td style="width:87%">Specifies the combination of <br /><a href="../FS_FILEMODE.html">FS_FILEMODE_*</a> flags that indicate the mode for accessing the file.</td>
34</tr>
35</tbody>
36</table>
37
38<h2>Return Values</h2>
39<p>TRUE if the file handle opens properly; FALSE otherwise. In case of failure, use <code><a href="FS_GetResultCode.html">FS_GetResultCode()</a></code> to get the error details.</p>
40
41<h2>Description</h2>
42<p>Opens the handle for the specified file.<br />You can use the <CODE>FS_OpenFileEx</CODE> function when the path is specified using <CODE>Shift_JIS</CODE> and the <CODE>FS_OpenFileExW</CODE> function when the path is specified using <CODE>UTF16-LE</CODE>. The results that are obtained will be the same. There are several conditions that apply to files that can be opened.</p>
43<ul>
44<li><font color="red">The file must already exist; it will not be created automatically, even if this function is called with <a href="../FS_FILEMODE.html">FS_FILEMODE_W</a> specified.</font><code><a href="../directory/FS_CreateFile.html">FS_CreateFile()</a></code> must be used to create a new file.</li>
45<li>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, <font color="red">this function will always fail and return <code><a href="../fs_result_const.html">FS_RESULT_PEMISSION_DENIED</a></code> if you try to open a file 2 GB or larger.</font></li>
46<li>If an attempt is made to open a TWL-only file while operating in NITRO mode, the function will fail and return <code><a href="../fs_result_const.html">FS_RESULT_PEMISSION_DENIED</a></code>. (For more information on the specification of TWL-only files, see the explanation about the <CODE>Put</CODE> parameter in <a href="../../tools/makerom.html">makerom.TWL</a>.)</li>
47</ul>
48<p>The various functions for file access can be called using the handle that is obtained. After using a handle, you must call <code><a href="FS_CloseFile.html">FS_CloseFile()</a></code> to free it.
49</p>
50
51<h2>Note</h2>
52<ul>
53<li>This function cannot be called from the interrupt handler (IRQ mode). Also, in some cases processing may not end if interrupts are left prohibited.</li>
54</ul>
55
56<h2>See Also</h2>
57<p><code><a href="../fs_file_type.html">FSFile</a> <a href="../FSDirectoryEntryInfo.html">FSDirectoryEntryInfo</a> <br /> <a href="FS_ReadFile.html">FS_ReadFile</a> <a href="FS_WriteFile.html">FS_WriteFile</a> <a href="FS_SeekFile.html">FS_SeekFile</a></code></p>
58
59<h2>Revision History</h2>
60<p>
612009/01/08 Added an explanation about TWL-only files.<br />2008/09/02 Added notes concerning a Unicode version of the function.<br />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.<br />2008/06/10 Added the fact that files will not be created automatically.<br />2007/09/18 Initial version.
62</p>
63<hr><p>CONFIDENTIAL</p></body>
64</html>
65