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_OpenDirectory[W]</title> 7<link rel="stylesheet" href="../../css/nitro.css" type="text/css" /> 8</head> 9<body> 10 11<h1>FS_OpenDirectory[W] <img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></h1> 12<h2>Syntax</h2> 13<pre><code> 14#include <nitro/fs.h> 15 16BOOL FS_OpenDirectory(<a href="../fs_file_type.html">FSFile</a> *dir, const char *path, u32 mode); 17BOOL FS_OpenDirectoryW(<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%"><SPAN class="argument">dir</SPAN></td> 25<td style="width:87%"><CODE>FSFile</CODE> structure where the handle is stored</td> 26</tr> 27<tr> 28<td style="width:13%"><SPAN class="argument">path</SPAN></td> 29<td style="width:87%">Directory's path</td> 30</tr> 31<tr> 32<td style="width:13%"><SPAN class="argument">mode</SPAN></td> 33<td style="width:87%">Combination of <a href="../FS_DIRMODE.html"><CODE>FS_DIRMODE_*</CODE></a> flags that indicates the mode for accessing the directory</td> 34</tr> 35</tbody> 36</table> 37 38<h2>Return Values</h2> 39<p><CODE>TRUE</CODE> if the directory handle opens properly; <CODE>FALSE</CODE> otherwise. In case of failure, use the <a href="../file/FS_GetResultCode.html"><CODE>FS_GetResultCode</CODE></a> function to get the error details.</p> 40 41<h2>Description</h2> 42<p>Opens the handle for the specified directory.<br />You can use the <CODE>FS_OpenDirectory</CODE> function when the path is specified using <CODE>Shift_JIS</CODE>, and the <CODE>FS_OpenDirectoryW</CODE> function when the path is specified using <CODE>UTF16-LE</CODE>. The results that are obtained will be the same. You can list all entry information in a directory, one at a time, by calling the <a href="FS_ReadDirectory.html"><CODE>FS_ReadDirectory</CODE></a> function with the handle that is obtained. After using a handle, you must call the <a href="FS_CloseDirectory.html"><CODE>FS_CloseDirectory</CODE></a> function to free it. <br />The function fails and returns <CODE>FALSE</CODE> in the following situations: 43</p> 44<ul> 45<li>If the target archive does not support opening directories</li> 46<li>If the specified directory does not exist</li> 47</ul> 48 49<h2>Note</h2> 50<ul> 51<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> 52<li style='color:Red;'>Because the structures of opened files are linked with system resources, you cannot move or duplicate the information in these structures by copying them into other structures. For details, see the <a href="../fs_file_type.html"><CODE>FSFile</CODE></a> structure.</li> 53</ul> 54 55<h2>See Also</h2> 56<p><a href="../fs_file_type.html"><CODE>FSFile</CODE></a><BR> <a href="../FSDirectoryEntryInfo.html"><CODE>FSDirectoryEntryInfo</CODE></a><BR> <a href="../FSDirectoryEntryInfo.html"><CODE>FSDirectoryEntryInfoW</CODE></a><br /> <a href="FS_ReadDirectory.html"><CODE>FS_ReadDirectory</CODE></a><BR> <a href="FS_CloseDirectory.html"><CODE>FS_CloseDirectory</CODE></a></p> 57 58<h2>Revision History</h2> 59<p> 602009/07/29 Added mention that copying structure values is not guaranteed.<br /> 2008/09/02 Added notes concerning a Unicode version of the function.<br />2008/07/16 Revised <B>Description</B> to use <CODE>FS_GetResultCode</CODE> for getting the error code in cases of failure.<br />2007/09/18 Initial version. 61</p> 62<hr><p>CONFIDENTIAL</p></body> 63</html> 64