1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
8<title>NANDCreate</title>
9</head>
10
11<body>
12
13<h1>NANDCreate</h1>
14
15<h2>Syntax</h2>
16<dl><dd><pre class="construction">#include &lt;revolution/nand.h&gt;
17
18#define NAND_PERM_OTHER_READ   0x01
19#define NAND_PERM_OTHER_WRITE  0x02
20#define NAND_PERM_GROUP_READ   0x04
21#define NAND_PERM_GROUP_WRITE  0x08
22#define NAND_PERM_OWNER_READ   0x10
23#define NAND_PERM_OWNER_WRITE  0x20
24
25s32 NANDCreate(const char *filename, u8 perm, u8 attr);
26</pre></dd></dl>
27
28<h2>Arguments</h2>
29<p>
30<TABLE class="arguments" border="1" >
31  <tr>
32<TH>filename</TH>
33<TD>Specifies the file name.</TD>
34  </tr>
35  <tr>
36<TH>perm</TH>
37<TD>File permissions. Specify by taking the bitwise OR of <code>NAND_PERM_*</code>.</TD>
38  </tr>
39  <tr>
40<TH>attr</TH>
41<TD>Specifies the file attributes.</TD>
42  </tr>
43</TABLE>
44</p>
45
46<h2>Return Values</h2>
47<p>
48Returns one of the following codes.
49<p>
50<code>NAND_RESULT_OK<br> NAND_RESULT_ACCESS<br> NAND_RESULT_ALLOC_FAILED<br> NAND_RESULT_BUSY<br> NAND_RESULT_CORRUPT<br> NAND_RESULT_EXISTS<br> NAND_RESULT_INVALID<br> NAND_RESULT_MAXFILES<br> NAND_RESULT_NOEXISTS<br> NAND_RESULT_UNKNOWN<br> NAND_RESULT_FATAL_ERROR<br></code>
51</p>
52</p>
53
54<H2>Description</H2>
55<p>
56Creates a new file. The specified permissions and attributes are given to the file. <font color="#ff0000">However, the file must be granted at least the <CODE>NAND_PERM_OWNER_READ</CODE> permission.</font></font> If the <CODE>NAND_PERM_OWNER_READ</CODE> permission is not granted, the function will return <CODE>NAND_RESULT_INVALID</CODE>. If nonusable characters are used for the filename, the function returns <CODE>NAND_RESULT_INVALID</CODE>. The usable characters include three symbols [ <CODE><B>_ - .</B></CODE> ], and all alphanumeric characters (0-9, a-z, and A-Z).
57</p>
58
59<p>
60This function sometimes puts the current thread to sleep, so it cannot be called from callback functions. For precautions related to calling similar functions, see <a href="../os/Interrupt/intro.html">Interrupts and Callback Functions</a>.
61</p>
62
63<p>
64This function updates the FAT of the Wii console NAND memory.
65</p>
66
67<h2>See Also</h2>
68<p class="reference">
69<a href="./NANDCreateAsync.html">NANDCreateAsync</a><BR><a href="./NANDDelete.html">NANDDelete</a><BR><a href="./NANDDeleteAsync.html">NANDDeleteAsync</a><BR><a href="../os/Interrupt/intro.html">Interrupts and Callback Functions</a>
70</p>
71
72<H2>Revision History</H2>
73<p>
742009/07/28 Explained that <CODE>NAND_RESULT_INVALID</CODE> is returned when an invalid filename is specified for the argument.<br>2008/04/23 Commented about updating the FAT.<br>2007/09/25 Added information about the sleep status of threads.<br>2006/11/30 Added the <CODE>NAND_RESULT_ALLOC_FAILED</CODE> and <CODE>NAND_RESULT_BUSY</CODE> codes.<br>2006/11/13 Added an explanation about the need to grant <CODE>NAND_PERM_OWNER_READ</CODE> permission.<br>2006/08/30 Added the <CODE>NAND_RESULT_NOEXISTS</CODE> result code.<br>2006/06/16 Initial version.<BR>
75</p>
76
77<hr><p>CONFIDENTIAL</p></body>
78</html>