1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../css/manpage.css" type="text/css" />
7    <style type="text/css"><!--
8      span.static_style
9      {
10        font-size			: 8pt;
11        color				: white;
12        font-weight			: bold;
13        background			: #44f;
14        border-left			: solid 1px #aaf;
15        border-top			: solid 1px #aaf;
16        border-right		: solid 1px #00c;
17        border-bottom		: solid 1px #00c;
18        padding-left		: 2px;
19        padding-right		: 2px;
20      }
21
22      span.virtual_style
23      {
24        font-size			 : 8pt;
25        color				 : white;
26        font-weight			: bold;
27        background			: #0a0;
28        border-left			: solid 1px #0f0;
29        border-top			: solid 1px #0f0;
30        border-right		: solid 1px #060;
31        border-bottom		: solid 1px #060;
32        padding-left		: 2px;
33        padding-right		: 2px;
34      }
35
36      span.protected_style
37      {
38        font-size			 : 8pt;
39        color				 : white;
40        font-weight			: bold;
41        background			: #444;
42        border-left			: solid 1px #ccc;
43        border-top			: solid 1px #ccc;
44        border-right		: solid 1px #222;
45        border-bottom		: solid 1px #222;
46        padding-left		: 2px;
47        padding-right		: 2px;
48      }
49        --></style>
50<title>nn::fs</title>
51  </head>
52  <body>
53<h1><CODE>nn::fs</CODE> Namespace</h1>
54<h2>Description</h2>
55    <div class="section">
56<p>Namespace for the file system API.</p><p>You must first call the <a href="../../nn/fs/Initialize.html"><CODE>nn::fs::Initialize</CODE></a> function to initialize the library before using any of the functions or classes in the <CODE><a href="../../nn/fs/Overview.html">nn::fs</a></CODE> namespace.
57            </p><p>
58The CTR file system is a collection of <I>archives</I> distinguished by their <I>archive names</I>. Files and directories are identified in the various archives by passing an <I>archive path name</I>, after which the specified operation is carried out. Archive types differ in various ways such as their available operations, their restrictions on path names, and the number of files that can be opened, but all types can generally be accessed using the same interface.
59            </p><p>
60The user specifies a <I>path name</I> in the format <CODE>&lt;archive name&gt;:&lt;archive path&gt;</CODE> to work with files or directories. The basic maximum length for archive paths is 253 characters, but certain archive types may have their own additional restrictions. For archives with a hierarchical directory structure, slashes (&quot;/&quot;) are used as the directory delimiter.
61            </p><p>
62Archives must be mounted before they can be accessed. Each archive type has its own mount function, and the arguments of those functions differ. If you specify an archive name when mounting an archive, you can then access that archive using a path that begins with the archive name. Once you no longer need the archive, you can unmount it by calling <a href="../../nn/fs/Unmount.html"><CODE>Unmount</CODE></a>.
63            </p><p>
64ROM archives are read-only archives for referencing the ROMFS that was created at build time. When ROM archives are used, they require a working memory region to be passed by the user application. These archives therefore require that a working memory region be specified when they are mounted by the <a href="../../nn/fs/MountRom.html"><CODE>nn::fs::MountRom</CODE></a> function. The numbers of files and directories that can be opened in ROM archives are passed as arguments to the <a href="../../nn/fs/MountRom.html"><CODE>nn::fs::MountRom</CODE></a> function, but the only constraint on these numbers is the amount of available memory. We recommend passing values to the <a href="../../nn/fs/MountRom.html"><CODE>nn::fs::MountRom</CODE></a> function that are no more than what you need. You can also choose whether to cache metadata such as the ROM filenames and directory names. If you enable caching, a larger working region will be required, but your application will be able to open files and work with directories more quickly.
65            </p><p>
66Save data (<CODE>SaveData</CODE>) archives are used for accessing program-specific save data regions. For programs launched from a CTR card (emulation memory), these archives access backup memory on the CTR card. For programs launched from NAND memory, these archives access save data created in NAND memory. Save data archives use a file system with a hierarchical directory structure, so they support the same types of file and directory operations that typical file systems do. Directory and file names in a save data archive are limited to a maximum of 16 characters.
67            </p><p>
68Although the <a href="../../nn/fs/MountSaveData.html"><CODE>nn::fs::MountSaveData</CODE></a> function is used to mount save data archives, you must format the save data region with the <a href="../../nn/fs/FormatSaveData.html"><CODE>nn::fs::FormatSaveData</CODE></a> function before you use save data for the first time. When you format a save data region, you can specify the maximum number of files and directories that can be created in it.
69            </p><p>
70The specifications of the save data that can be accessed by save data archives may change in the future; for example, features might be added to prevent data corruption.
71</p><p>Extended save data archives are archives created on an SD Memory Card where the data memory region is managed separately from save data. In order to use an extended save data archive, the application must explicitly create one. File and directory operations are available just as with a save data archive, but there is a limit of 248 characters on path length.</p><p>
72SDMC archives are used for directly accessing SD Memory Cards for debugging purposes. An inserted SD Memory Card can be mounted using the MountSdmc function. To mount a previously mounted SD Memory Card that has been pulled out and then re-inserted, it must first be unmounted using the <a href="../../nn/fs/Unmount.html">nn::fs::Unmount</a> function and then the <a href="../../nn/fs/MountSdmc.html">nn::fs::MountSdmc</a> function must be executed again. SDMC archives are only for debugging and cannot be accessed from retail versions.
73            </p></div>
74    <a name="namespace" id="namespace">
75<h2>Namespaces</h2>
76      <div class="section">
77        <table class="members">
78          <tr>
79            <th>
80<a href="../../nn/fs/hio/Overview.html"><CODE>nn::fs::hio</CODE></a>
81            </th>
82<td>A namespace that includes functions used to directly access files on a computer (PC).</td>
83          </tr>
84        </table>
85      </div>
86    </a> <a name="class" id="class">
87<h2>Classes</h2>
88      <div class="section">
89        <table class="members">
90          <tr>
91            <th>
92<a href="../../nn/fs/Directory/Overview.html"><CODE>nn::fs::Directory</CODE></a>
93            </th>
94<td>A class used for directory operations.</td>
95          </tr>
96          <tr>
97            <th>
98<a href="../../nn/fs/FileInputStream/Overview.html"><CODE>nn::fs::FileInputStream</CODE></a>
99            </th>
100<td>Class for reading from files.</td>
101          </tr>
102          <tr>
103            <th>
104<a href="../../nn/fs/FileOutputStream/Overview.html"><CODE>nn::fs::FileOutputStream</CODE></a>
105            </th>
106<td>Class for writing to files.</td>
107          </tr>
108          <tr>
109            <th>
110<a href="../../nn/fs/FileStream/Overview.html"><CODE>nn::fs::FileStream</CODE></a>
111            </th>
112<td>Class for reading from and writing to files.</td>
113          </tr>
114        </table>
115      </div>
116    </a> <a name="enum" id="enum">
117<h2>Enumerated Types</h2>
118      <div class="section">
119        <table class="members">
120          <tr>
121            <td width="100"> </td>
122            <th>
123<a href="../../nn/fs/PositionBase.html"><CODE>PositionBase</CODE></a>
124            </th>
125<td>Group of constants that indicate the position of file read/writes.</td>
126          </tr> </table>
127      </div>
128    </a> <a name="typedef" id="typedef">
129<h2><CODE>typedef</CODE> Definitions</h2>
130      <div class="section">
131        <table class="members">
132          <tr>
133            <td width="100" />
134            <th>
135<a href="../../nn/fs/FileReader.html"><CODE>FileReader</CODE></a>
136            </th>
137<td>A <CODE>typedef</CODE> for <CODE><a href="../../nn/fs/FileInputStream/Overview.html">FileInputStream</a></CODE>.</td>
138          </tr> </table>
139      </div>
140    </a> <a name="function" id="function">
141<h2>Functions</h2>
142      <div class="section">
143        <table class="members">
144          <tr>
145            <td width="100">  </td>
146            <th>
147<a href="../../nn/fs/GetRomRequiredMemorySize.html"><CODE>GetRomRequiredMemorySize</CODE></a>
148            </th>
149<td>Gets the size of memory needed to mount a ROM archive.</td>
150          </tr>
151          <tr>
152            <td width="100">  </td>
153            <th>
154<a href="../../nn/fs/MountRom.html"><CODE>MountRom</CODE></a>
155            </th>
156<td>Mounts a ROM archive.</td>
157          </tr>
158          <tr>
159            <td width="100">  </td>
160            <th>
161<a href="../../nn/fs/FormatSaveData.html"><CODE>FormatSaveData</CODE></a>
162            </th>
163<td>Formats a save data region.</td>
164          </tr>
165          <tr>
166            <td width="100">  </td>
167            <th>
168<a href="../../nn/fs/MountSaveData.html"><CODE>MountSaveData</CODE></a>
169            </th>
170<td>Mounts a save data archive.</td>
171          </tr>
172          <tr>
173            <td width="100">  </td>
174            <th>
175<a href="../../nn/fs/CommitSaveData.html"><CODE>CommitSaveData</CODE></a>
176            </th>
177<td>Commits a change to the save data. <BR>(<B>Note:</B> The commit feature has not yet been implemented.)</td>
178          </tr>
179          <tr>
180            <td width="100">  </td>
181            <th>
182<a href="../../nn/fs/CreateExtSaveData.html">CreateExtSaveData</a>
183            </th>
184<td>Creates an extended save data memory region.</td>
185          </tr>
186          <tr>
187            <td width="100">  </td>
188            <th>
189<a href="../../nn/fs/MountExtSaveData.html"><CODE>MountExtSaveData</CODE></a>
190            </th>
191<td>Mounts extended save data.</td>
192          </tr>
193          <tr>
194            <td width="100">  </td>
195            <th>
196<a href="../../nn/fs/CreateAndMountExtSaveData.html"><CODE>CreateAndMountExtSaveData</CODE></a>
197            </th>
198<td>Creates extended save data and then mounts it.</td>
199          </tr>
200          <tr>
201            <td width="100">  </td>
202            <th>
203<a href="../../nn/fs/FormatAndMountExtSaveData.html">FormatAndMountExtSaveData</a>
204            </th>
205<td>Formats extended save data and mounts it.</td>
206          </tr>
207          <tr>
208            <td width="100">  </td>
209            <th>
210<a href="../../nn/fs/ReadExtSaveDataIcon.html"><CODE>ReadExtSaveDataIcon</CODE></a>
211            </th>
212<td>Reads extended save data icons.</td>
213          </tr>
214          <tr>
215            <td width="100">  </td>
216            <th>
217<a href="../../nn/fs/Unmount.html"><CODE>Unmount</CODE></a>
218            </th>
219<td>Unmounts an archive.</td>
220          </tr>
221          <tr>
222            <td width="100">  </td>
223            <th>
224<a href="../../nn/fs/MountSdmc.html">MountSdmc</a>
225            </th>
226<td>Mounts an archive that directly accesses the SD Memory Card (for debugging only).</td>
227          </tr>
228          <tr>
229            <td width="100">  </td>
230            <th>
231<a href="../../nn/fs/GetFileSystemSize.html">GetFileSystemSize</a>
232            </th>
233<td>Gets the total media capacity and amount of free space.</td>
234          </tr>
235          <tr>
236            <td width="100">  </td>
237            <th>
238<a href="../../nn/fs/GetArchiveFreeBytes.html">GetArchiveFreeBytes</a>
239            </th>
240<td>Gets the amount of free space in the archive.</td>
241          </tr>
242          <tr>
243            <td width="100">  </td>
244            <th>
245<a href="../../nn/fs/Initialize.html"><CODE>Initialize</CODE></a>
246            </th>
247<td>Initializes the FS library.</td>
248          </tr>
249          <tr>
250            <td width="100">  </td>
251            <th>
252<a href="../../nn/fs/RegisterCardInsertedEvent.html">RegisterCardInsertedEvent</a>
253            </th>
254<td>Registers the <a href="../../../nn/os/LightEvent/Overview.html"><CODE>nn::os::LightEvent</CODE></a> object that is signaled when a game card is inserted.</td>
255          </tr>
256          <tr>
257            <td width="100">  </td>
258            <th>
259<a href="../../nn/fs/UnregisterCardInsertedEvent.html">UnregisterCardInsertedEvent</a>
260            </th>
261<td>Unregisters the <a href="../../nn/fs/RegisterCardInsertedEvent.html">nn::fs::RegisterCardInsertedEvent</a> object.</td>
262          </tr>
263          <tr>
264            <td width="100">  </td>
265            <th>
266<a href="../../nn/fs/RegisterCardEjectedEvent.html">RegisterCardEjectedEvent</a>
267            </th>
268<td>Registers the <a href="../../../nn/os/LightEvent/Overview.html"><CODE>nn::os::LightEvent</CODE></a> object that is signaled when a game card is pulled out.</td>
269          </tr>
270          <tr>
271            <td width="100">  </td>
272            <th>
273<a href="../../nn/fs/UnregisterCardEjectedEvent.html">UnregisterCardEjectedEvent</a>
274            </th>
275<td>Unregisters the <a href="../../nn/fs/RegisterCardEjectedEvent.html">nn::fs::RegisterCardEjectedEvent</a> object.</td>
276          </tr>
277          <tr>
278            <td width="100">  </td>
279            <th>
280<a href="../../nn/fs/IsCardInserted.html">IsCardInserted</a>
281            </th>
282<td>Returns whether a game card has been inserted.</td>
283          </tr>
284          <tr>
285            <td width="100">  </td>
286            <th>
287<a href="../../nn/fs/RegisterSdmcInsertedEvent.html">RegisterSdmcInsertedEvent</a>
288            </th>
289<td>Registers the <a href="../../../nn/os/LightEvent/Overview.html"><CODE>nn::os::LightEvent</CODE></a> object that is signaled when an SD Memory Card is inserted.</td>
290          </tr>
291          <tr>
292            <td width="100">  </td>
293            <th>
294<a href="../../nn/fs/UnregisterSdmcInsertedEvent.html">UnregisterSdmcInsertedEvent</a>
295            </th>
296<td>Unregisters the <a href="../../nn/fs/RegisterSdmcInsertedEvent.html">nn::fs::RegisterSdmcInsertedEvent</a> object.</td>
297          </tr>
298          <tr>
299            <td width="100">  </td>
300            <th>
301<a href="../../nn/fs/RegisterSdmcEjectedEvent.html">RegisterSdmcEjectedEvent</a>
302            </th>
303<td>Registers the <a href="../../../nn/os/LightEvent/Overview.html"><CODE>nn::os::LightEvent</CODE></a> object that is signaled when an SD Memory Card is pulled out.</td>
304          </tr>
305          <tr>
306            <td width="100">  </td>
307            <th>
308<a href="../../nn/fs/UnregisterSdmcEjectedEvent.html">UnregisterSdmcEjectedEvent</a>
309            </th>
310<td>Unregisters the <a href="../../nn/fs/RegisterSdmcEjectedEvent.html">nn::fs::RegisterSdmcEjectedEvent</a> object.</td>
311          </tr>
312          <tr>
313            <td width="100">  </td>
314            <th>
315<a href="../../nn/fs/IsSdmcInserted.html"><CODE>IsSdmcInserted</CODE></a>
316            </th>
317<td>Returns a value indicating whether an SD Card has been inserted.</td>
318          </tr>
319          <tr>
320            <td width="100">  </td>
321            <th>
322<a href="../../nn/fs/IsSdmcWritable.html"><CODE>IsSdmcWritable</CODE></a>
323            </th>
324<td>Returns a value indicating whether an SD Card is writable.</td>
325          </tr>
326          <tr>
327            <td width="100">  </td>
328            <th>
329<a href="../../nn/fs/DeleteFile.html"><CODE>DeleteFile</CODE></a>
330            </th>
331<td>Deletes a file.</td>
332          </tr>
333          <tr>
334            <td width="100">  </td>
335            <th>
336<a href="../../nn/fs/TryDeleteFile.html"><CODE>TryDeleteFile</CODE></a>
337            </th>
338<td>Deletes a file.</td>
339          </tr>
340          <tr>
341            <td width="100">  </td>
342            <th>
343<a href="../../nn/fs/RenameFile.html"><CODE>RenameFile</CODE></a>
344            </th>
345<td>Renames a file.</td>
346          </tr>
347          <tr>
348            <td width="100">  </td>
349            <th>
350<a href="../../nn/fs/TryRenameFile.html"><CODE>TryRenameFile</CODE></a>
351            </th>
352<td>Renames a file.</td>
353          </tr>
354          <tr>
355            <td width="100">  </td>
356            <th>
357<a href="../../nn/fs/DeleteDirectory.html"><CODE>DeleteDirectory</CODE></a>
358            </th>
359<td>Deletes a directory.</td>
360          </tr>
361          <tr>
362            <td width="100">  </td>
363            <th>
364<a href="../../nn/fs/TryDeleteDirectory.html"><CODE>TryDeleteDirectory</CODE></a>
365            </th>
366<td>Deletes a directory.</td>
367          </tr>
368          <tr>
369            <td width="100">  </td>
370            <th>
371<a href="../../nn/fs/TryDeleteDirectoryRecursively.html">TryDeleteDirectoryRecursively</a>
372            </th>
373<td>Deletes directories recursively.</td>
374          </tr>
375          <tr>
376            <td width="100">  </td>
377            <th>
378<a href="../../nn/fs/CreateDirectory.html"><CODE>CreateDirectory</CODE></a>
379            </th>
380<td>Creates a directory.</td>
381          </tr>
382          <tr>
383            <td width="100">  </td>
384            <th>
385<a href="../../nn/fs/TryCreateDirectory.html"><CODE>TryCreateDirectory</CODE></a>
386            </th>
387<td>Creates a directory.</td>
388          </tr>
389          <tr>
390            <td width="100">  </td>
391            <th>
392<a href="../../nn/fs/RenameDirectory.html"><CODE>RenameDirectory</CODE></a>
393            </th>
394<td>Renames a directory.</td>
395          </tr>
396          <tr>
397            <td width="100">  </td>
398            <th>
399<a href="../../nn/fs/TryRenameDirectory.html"><CODE>TryRenameDirectory</CODE></a>
400            </th>
401<td>Renames a directory.</td>
402          </tr> </table>
403      </div>
404    </a>
405<h2>Revision History</h2>
406    <div class="section">
407      <dl class="history">
408        <dt>2010/09/22</dt>
409<dd>Added a description of extended save data.<BR>
410        </dd>
411        <dt>2010/09/10</dt>
412<dd>Added the MountSdmc function.<BR>
413        </dd>
414        <dt>2010/09/09</dt>
415<dd>Deleted the InitializeForFileSystemEvent, WaitForInsertSdmc, and WaitForEjectSdmc functions. Added the RegisterSdmcInsertedEvent, UnregisterSdmcInsertedEvent, RegisterSdmcEjectedEvent, and UnregisterSdmcEjectedEvent functions.<br />
416        </dd>
417        <dt>2010/01/07</dt>
418<dd>Initial version.<br />
419        </dd>
420      </dl>
421    </div>
422  <hr><p>CONFIDENTIAL</p></body>
423</html>