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=windows-1252">
6<META http-equiv="Content-Style-Type" content="text/css">
7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
8<title>VFOpenFile(W)</title>
9</head>
10
11<body>
12
13<h1>VFOpenFile(W)</h1>
14
15<h2>C Specification</h2>
16<dl><dd><pre><code>
17#include &lt;revolution/vf.h&gt;
18
19typedef void	VFFile;
20
21VFFile* VFOpenFile( const char* path, const char* mode, u32 attr );
22VFFile* VFOpenFileW( const VFWchar* path, const VFWchar* mode, u32 attr );
23</code></pre></dd></dl>
24
25<h2>Arguments</h2>
26<p>
27<TABLE border="1" >
28  <tr>
29<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>path</EM></STRONG></CODE></TD>
30<TD width="520">The address storing the path and file name.<BR>Either a full or relative path may be specified.</TD>
31  </tr>
32  <tr>
33<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>mode</EM></STRONG></CODE></TD>
34<TD width="520">The permitted access mode.</TD>
35  </tr>
36  <tr>
37<TD valign="top" width="120" bgcolor="#ffffe8"><CODE><STRONG><EM>attr</EM></STRONG></CODE></TD>
38<TD width="520">Specifies the file attributes. (Not currently used.)<BR>To assure future compatibility, always specify 0.</TD>
39  </tr>
40</TABLE>
41</p>
42
43<h2>Return Values</h2>
44<PRE>
45Pointer for the file descriptor.
46NULL is returned if the function fails.
47
48You can get details about the error using <a href="./VFGetLastError.html"><CODE>VFGetLastError</CODE></a>.
49</PRE>
50
51
52<H2>Description</H2>
53<p>
54Opens a file.<BR>The following access modes can be specified as the string for mode, the second argument.
55<TABLE border="0" >
56  <tr>
57<TD valign="top" nowrap><CODE><STRONG><EM>&quot;r&quot;</EM></STRONG></CODE></TD>
58<TD width="520">Opens in read mode.</TD>
59  </tr>
60  <tr>
61<TD valign="top" nowrap><CODE><STRONG><EM>&quot;w&quot;</EM></STRONG></CODE></TD>
62<TD width="520">Opens a blank file in write mode.<BR>When the specified file already exists, the previous file's content is destroyed.</TD>
63  </tr>
64  <tr>
65<TD valign="top" nowrap><CODE><STRONG><EM>&quot;a&quot;</EM></STRONG></CODE></TD>
66<TD width="520">Opens a file in append mode (where writes occur at the end of the file).<BR>If the file doesn't exist, it is created.</TD>
67  </tr>
68  <tr>
69<TD valign="top" nowrap><CODE><STRONG><EM>&quot;r+&quot;</EM></STRONG></CODE></TD>
70<TD width="520">Opens a file in read/write mode.<BR>If the file doesn't exist, an error occurs.</TD>
71  </tr>
72  <tr>
73<TD valign="top" nowrap><CODE><STRONG><EM>&quot;w+&quot;</EM></STRONG></CODE></TD>
74<TD width="520">Opens a blank file in read/write mode.<BR>When the specified file already exists, the previous file's content is destroyed.</TD>
75  </tr>
76  <tr>
77<TD valign="top" nowrap><CODE><STRONG><EM>&quot;a+&quot;</EM></STRONG></CODE></TD>
78<TD width="520">Opens a file in read/append mode.<BR>If the file doesn't exist. it is created.</TD>
79  </tr>
80</TABLE>
81Specifying NULL for an access mode has the same effect as using &quot;r+&quot;.<BR><STRONG>Note:</STRONG> Although it is possible to re-open files that are already open with modes other that &quot;w&quot; or &quot;w+&quot;, the newly opened copy of the file will have a separate descriptor, requiring caution when reading or writing such files.<BR>For example: <br>If you write a certain file specifying its file descriptor, and then write that same file using a separate descriptor, you may not be able to save data accurately. For this reason, do not attempt to perform read/write operations on the same file using multiple descriptors at the same time. If you do, the accuracy of the data cannot be guaranteed. <br>
82</p>
83
84<h2>See Also</h2>
85<p>
86<code><a href="./VFCreateFile.html">VFCreateFile</a></code>, <code><a href="./VFSeekFile.html">VFSeekFile</a></code>, <code><a href="./VFReadFile.html">VFReadFile</a></code>, <code><a href="./VFWriteFile.html">VFWriteFile</a></code>, <code><a href="./VFCloseFile.html">VFCloseFile</a></code>, <code><a href="./VFDeleteFile.html">VFDeleteFile</a></code>
87</p>
88
89<H2>Revision History</H2>
90<p>
912006/06/23<br>2007/05/08 Added description of Return Values.
92</p>
93
94
95<hr><p>CONFIDENTIAL</p></body>
96</html>
97