Rev Author Line No. Line
1110 kaklik 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3 <title>sd-reader: FAT16 file functions</title>
4 <link href="doxygen.css" rel="stylesheet" type="text/css">
5 <link href="tabs.css" rel="stylesheet" type="text/css">
6 </head><body>
7 <!-- Generated by Doxygen 1.5.3-20071008 -->
8 <div class="tabs">
9 <ul>
10 <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
11 <li><a href="modules.html"><span>Modules</span></a></li>
12 <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
13 <li><a href="files.html"><span>Files</span></a></li>
14 </ul>
15 </div>
16 <h1>FAT16 file functions<br>
17 <small>
18 [<a class="el" href="group__fat16.html">FAT16 support</a>]</small>
19 </h1><hr><a name="_details"></a><h2>Detailed Description</h2>
20 Functions for managing files.
21 <p>
22  
23 <p>
24 <table border="0" cellpadding="0" cellspacing="0">
25 <tr><td></td></tr>
26 <tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
27 <tr><td class="memItemLeft" nowrap align="right" valign="top">struct &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a></td></tr>
28  
29 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Describes a directory entry. <a href="structfat16__dir__entry__struct.html#_details">More...</a><br></td></tr>
30 <tr><td colspan="2"><br><h2>Defines</h2></td></tr>
31 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g1c4ea0b6e1087b1a88d26b8942c5d923">FAT16_ATTRIB_READONLY</a></td></tr>
32  
33 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The file is read-only. <a href="#g1c4ea0b6e1087b1a88d26b8942c5d923"></a><br></td></tr>
34 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g229780f6a88ab775ea82264c9f1e0616">FAT16_ATTRIB_HIDDEN</a></td></tr>
35  
36 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The file is hidden. <a href="#g229780f6a88ab775ea82264c9f1e0616"></a><br></td></tr>
37 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#ga0badbbc92da7601b4a51d99ba7e8f8f">FAT16_ATTRIB_SYSTEM</a></td></tr>
38  
39 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The file is a system file. <a href="#ga0badbbc92da7601b4a51d99ba7e8f8f"></a><br></td></tr>
40 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#gc1341eb7b40d2f48cacf9b9d8aedbb6c">FAT16_ATTRIB_VOLUME</a></td></tr>
41  
42 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The file is empty and has the volume label as its name. <a href="#gc1341eb7b40d2f48cacf9b9d8aedbb6c"></a><br></td></tr>
43 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#gafdb0e859960ff33b11b6c55b3188274">FAT16_ATTRIB_DIR</a></td></tr>
44  
45 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The file is a directory. <a href="#gafdb0e859960ff33b11b6c55b3188274"></a><br></td></tr>
46 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g8e472239ee6baede688a01eaa45551a9">FAT16_ATTRIB_ARCHIVE</a></td></tr>
47  
48 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The file has to be archived. <a href="#g8e472239ee6baede688a01eaa45551a9"></a><br></td></tr>
49 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#gb90aeb34840c0ea33c8ae9d7577def65">FAT16_SEEK_SET</a></td></tr>
50  
51 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The given offset is relative to the beginning of the file. <a href="#gb90aeb34840c0ea33c8ae9d7577def65"></a><br></td></tr>
52 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g432820c6f8c90e11a92efc931c3b8a3a">FAT16_SEEK_CUR</a></td></tr>
53  
54 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The given offset is relative to the current read/write position. <a href="#g432820c6f8c90e11a92efc931c3b8a3a"></a><br></td></tr>
55 <tr><td class="memItemLeft" nowrap align="right" valign="top">#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g3793e580ccfcd5e68b95a0740c000e39">FAT16_SEEK_END</a></td></tr>
56  
57 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The given offset is relative to the end of the file. <a href="#g3793e580ccfcd5e68b95a0740c000e39"></a><br></td></tr>
58 <tr><td colspan="2"><br><h2>Functions</h2></td></tr>
59 <tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g0045fe378de2f7c52b528f985e1891a6">fat16_get_dir_entry_of_path</a> (struct fat16_fs_struct *fs, const char *path, struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *dir_entry)</td></tr>
60  
61 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Retrieves the directory entry of a path. <a href="#g0045fe378de2f7c52b528f985e1891a6"></a><br></td></tr>
62 <tr><td class="memItemLeft" nowrap align="right" valign="top">struct fat16_file_struct *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g3a43c9943251749978645ad8e3f16757">fat16_open_file</a> (struct fat16_fs_struct *fs, const struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *dir_entry)</td></tr>
63  
64 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Opens a file on a FAT16 filesystem. <a href="#g3a43c9943251749978645ad8e3f16757"></a><br></td></tr>
65 <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g2b2812041f489bc7913bfa5cbcf0172b">fat16_close_file</a> (struct fat16_file_struct *fd)</td></tr>
66  
67 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Closes a file. <a href="#g2b2812041f489bc7913bfa5cbcf0172b"></a><br></td></tr>
68 <tr><td class="memItemLeft" nowrap align="right" valign="top">int16_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g0af2ef3d690626a5640a334cefbb27a6">fat16_read_file</a> (struct fat16_file_struct *fd, uint8_t *buffer, uint16_t buffer_len)</td></tr>
69  
70 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Reads data from a file. <a href="#g0af2ef3d690626a5640a334cefbb27a6"></a><br></td></tr>
71 <tr><td class="memItemLeft" nowrap align="right" valign="top">int16_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g4f0c785a47b1cf070839b5edec2c6f65">fat16_write_file</a> (struct fat16_file_struct *fd, const uint8_t *buffer, uint16_t buffer_len)</td></tr>
72  
73 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Writes data to a file. <a href="#g4f0c785a47b1cf070839b5edec2c6f65"></a><br></td></tr>
74 <tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#gf1511fd1a5419d0828265566dc5d33e4">fat16_seek_file</a> (struct fat16_file_struct *fd, int32_t *offset, uint8_t whence)</td></tr>
75  
76 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Repositions the read/write file offset. <a href="#gf1511fd1a5419d0828265566dc5d33e4"></a><br></td></tr>
77 <tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g23740742fa60ca148ef098caac7085c0">fat16_resize_file</a> (struct fat16_file_struct *fd, uint32_t size)</td></tr>
78  
79 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Resizes a file to have a specific size. <a href="#g23740742fa60ca148ef098caac7085c0"></a><br></td></tr>
80 <tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#gf8029e3ec633902d08e8204d13afc350">fat16_create_file</a> (struct fat16_dir_struct *parent, const char *file, struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *dir_entry)</td></tr>
81  
82 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates a file. <a href="#gf8029e3ec633902d08e8204d13afc350"></a><br></td></tr>
83 <tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#ge060faccbbeca802afe86be2f4d5b485">fat16_delete_file</a> (struct fat16_fs_struct *fs, struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *dir_entry)</td></tr>
84  
85 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Deletes a file or directory. <a href="#ge060faccbbeca802afe86be2f4d5b485"></a><br></td></tr>
86 <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g82c7347c5b3cd8832633d5303552eb38">fat16_get_file_modification_date</a> (const struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *dir_entry, uint16_t *year, uint8_t *month, uint8_t *day)</td></tr>
87  
88 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the modification date of a file. <a href="#g82c7347c5b3cd8832633d5303552eb38"></a><br></td></tr>
89 <tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g5040fcab753ef55337292daf8c0d6784">fat16_get_file_modification_time</a> (const struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *dir_entry, uint8_t *hour, uint8_t *min, uint8_t *sec)</td></tr>
90  
91 <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the modification time of a file. <a href="#g5040fcab753ef55337292daf8c0d6784"></a><br></td></tr>
92 </table>
93 <hr><h2>Define Documentation</h2>
94 <a class="anchor" name="g8e472239ee6baede688a01eaa45551a9"></a><!-- doxytag: member="fat16.h::FAT16_ATTRIB_ARCHIVE" ref="g8e472239ee6baede688a01eaa45551a9" args="" -->
95 <div class="memitem">
96 <div class="memproto">
97 <table class="memname">
98 <tr>
99 <td class="memname">#define FAT16_ATTRIB_ARCHIVE </td>
100 </tr>
101 </table>
102 </div>
103 <div class="memdoc">
104  
105 <p>
106 The file has to be archived.
107 <p>
108  
109 </div>
110 </div><p>
111 <a class="anchor" name="gafdb0e859960ff33b11b6c55b3188274"></a><!-- doxytag: member="fat16.h::FAT16_ATTRIB_DIR" ref="gafdb0e859960ff33b11b6c55b3188274" args="" -->
112 <div class="memitem">
113 <div class="memproto">
114 <table class="memname">
115 <tr>
116 <td class="memname">#define FAT16_ATTRIB_DIR </td>
117 </tr>
118 </table>
119 </div>
120 <div class="memdoc">
121  
122 <p>
123 The file is a directory.
124 <p>
125  
126 </div>
127 </div><p>
128 <a class="anchor" name="g229780f6a88ab775ea82264c9f1e0616"></a><!-- doxytag: member="fat16.h::FAT16_ATTRIB_HIDDEN" ref="g229780f6a88ab775ea82264c9f1e0616" args="" -->
129 <div class="memitem">
130 <div class="memproto">
131 <table class="memname">
132 <tr>
133 <td class="memname">#define FAT16_ATTRIB_HIDDEN </td>
134 </tr>
135 </table>
136 </div>
137 <div class="memdoc">
138  
139 <p>
140 The file is hidden.
141 <p>
142  
143 </div>
144 </div><p>
145 <a class="anchor" name="g1c4ea0b6e1087b1a88d26b8942c5d923"></a><!-- doxytag: member="fat16.h::FAT16_ATTRIB_READONLY" ref="g1c4ea0b6e1087b1a88d26b8942c5d923" args="" -->
146 <div class="memitem">
147 <div class="memproto">
148 <table class="memname">
149 <tr>
150 <td class="memname">#define FAT16_ATTRIB_READONLY </td>
151 </tr>
152 </table>
153 </div>
154 <div class="memdoc">
155  
156 <p>
157 The file is read-only.
158 <p>
159  
160 </div>
161 </div><p>
162 <a class="anchor" name="ga0badbbc92da7601b4a51d99ba7e8f8f"></a><!-- doxytag: member="fat16.h::FAT16_ATTRIB_SYSTEM" ref="ga0badbbc92da7601b4a51d99ba7e8f8f" args="" -->
163 <div class="memitem">
164 <div class="memproto">
165 <table class="memname">
166 <tr>
167 <td class="memname">#define FAT16_ATTRIB_SYSTEM </td>
168 </tr>
169 </table>
170 </div>
171 <div class="memdoc">
172  
173 <p>
174 The file is a system file.
175 <p>
176  
177 </div>
178 </div><p>
179 <a class="anchor" name="gc1341eb7b40d2f48cacf9b9d8aedbb6c"></a><!-- doxytag: member="fat16.h::FAT16_ATTRIB_VOLUME" ref="gc1341eb7b40d2f48cacf9b9d8aedbb6c" args="" -->
180 <div class="memitem">
181 <div class="memproto">
182 <table class="memname">
183 <tr>
184 <td class="memname">#define FAT16_ATTRIB_VOLUME </td>
185 </tr>
186 </table>
187 </div>
188 <div class="memdoc">
189  
190 <p>
191 The file is empty and has the volume label as its name.
192 <p>
193  
194 </div>
195 </div><p>
196 <a class="anchor" name="g432820c6f8c90e11a92efc931c3b8a3a"></a><!-- doxytag: member="fat16.h::FAT16_SEEK_CUR" ref="g432820c6f8c90e11a92efc931c3b8a3a" args="" -->
197 <div class="memitem">
198 <div class="memproto">
199 <table class="memname">
200 <tr>
201 <td class="memname">#define FAT16_SEEK_CUR </td>
202 </tr>
203 </table>
204 </div>
205 <div class="memdoc">
206  
207 <p>
208 The given offset is relative to the current read/write position.
209 <p>
210  
211 </div>
212 </div><p>
213 <a class="anchor" name="g3793e580ccfcd5e68b95a0740c000e39"></a><!-- doxytag: member="fat16.h::FAT16_SEEK_END" ref="g3793e580ccfcd5e68b95a0740c000e39" args="" -->
214 <div class="memitem">
215 <div class="memproto">
216 <table class="memname">
217 <tr>
218 <td class="memname">#define FAT16_SEEK_END </td>
219 </tr>
220 </table>
221 </div>
222 <div class="memdoc">
223  
224 <p>
225 The given offset is relative to the end of the file.
226 <p>
227  
228 </div>
229 </div><p>
230 <a class="anchor" name="gb90aeb34840c0ea33c8ae9d7577def65"></a><!-- doxytag: member="fat16.h::FAT16_SEEK_SET" ref="gb90aeb34840c0ea33c8ae9d7577def65" args="" -->
231 <div class="memitem">
232 <div class="memproto">
233 <table class="memname">
234 <tr>
235 <td class="memname">#define FAT16_SEEK_SET </td>
236 </tr>
237 </table>
238 </div>
239 <div class="memdoc">
240  
241 <p>
242 The given offset is relative to the beginning of the file.
243 <p>
244  
245 </div>
246 </div><p>
247 <hr><h2>Function Documentation</h2>
248 <a class="anchor" name="g2b2812041f489bc7913bfa5cbcf0172b"></a><!-- doxytag: member="fat16.c::fat16_close_file" ref="g2b2812041f489bc7913bfa5cbcf0172b" args="(struct fat16_file_struct *fd)" -->
249 <div class="memitem">
250 <div class="memproto">
251 <table class="memname">
252 <tr>
253 <td class="memname">void fat16_close_file </td>
254 <td>(</td>
255 <td class="paramtype">struct fat16_file_struct *&nbsp;</td>
256 <td class="paramname"> <em>fd</em> </td>
257 <td>&nbsp;)&nbsp;</td>
258 <td width="100%"></td>
259 </tr>
260 </table>
261 </div>
262 <div class="memdoc">
263  
264 <p>
265 Closes a file.
266 <p>
267 <dl compact><dt><b>Parameters:</b></dt><dd>
268 <table border="0" cellspacing="2" cellpadding="0">
269 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>fd</em>&nbsp;</td><td>The file handle of the file to close. </td></tr>
270 </table>
271 </dl>
272 <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#g3a43c9943251749978645ad8e3f16757" title="Opens a file on a FAT16 filesystem.">fat16_open_file</a> </dd></dl>
273  
274 </div>
275 </div><p>
276 <a class="anchor" name="gf8029e3ec633902d08e8204d13afc350"></a><!-- doxytag: member="fat16.c::fat16_create_file" ref="gf8029e3ec633902d08e8204d13afc350" args="(struct fat16_dir_struct *parent, const char *file, struct fat16_dir_entry_struct *dir_entry)" -->
277 <div class="memitem">
278 <div class="memproto">
279 <table class="memname">
280 <tr>
281 <td class="memname">uint8_t fat16_create_file </td>
282 <td>(</td>
283 <td class="paramtype">struct fat16_dir_struct *&nbsp;</td>
284 <td class="paramname"> <em>parent</em>, </td>
285 </tr>
286 <tr>
287 <td class="paramkey"></td>
288 <td></td>
289 <td class="paramtype">const char *&nbsp;</td>
290 <td class="paramname"> <em>file</em>, </td>
291 </tr>
292 <tr>
293 <td class="paramkey"></td>
294 <td></td>
295 <td class="paramtype">struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
296 <td class="paramname"> <em>dir_entry</em></td><td>&nbsp;</td>
297 </tr>
298 <tr>
299 <td></td>
300 <td>)</td>
301 <td></td><td></td><td width="100%"></td>
302 </tr>
303 </table>
304 </div>
305 <div class="memdoc">
306  
307 <p>
308 Creates a file.
309 <p>
310 Creates a file and obtains the directory entry of the new file. If the file to create already exists, the directory entry of the existing file will be returned within the dir_entry parameter.<p>
311 <dl class="note" compact><dt><b>Note:</b></dt><dd>The file name is not checked for invalid characters.<p>
312 The generation of the short 8.3 file name is quite simple. The first eight characters are used for the filename. The extension, if any, is made up of the first three characters following the last dot within the long filename. If the filename (without the extension) is longer than eight characters, the lower byte of the cluster number replaces the last two characters to avoid name clashes. In any other case, it is your responsibility to avoid name clashes.</dd></dl>
313 <dl compact><dt><b>Parameters:</b></dt><dd>
314 <table border="0" cellspacing="2" cellpadding="0">
315 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>parent</em>&nbsp;</td><td>The handle of the directory in which to create the file. </td></tr>
316 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>file</em>&nbsp;</td><td>The name of the file to create. </td></tr>
317 <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>dir_entry</em>&nbsp;</td><td>The directory entry to fill for the new file. </td></tr>
318 </table>
319 </dl>
320 <dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
321 <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#ge060faccbbeca802afe86be2f4d5b485" title="Deletes a file or directory.">fat16_delete_file</a> </dd></dl>
322  
323 </div>
324 </div><p>
325 <a class="anchor" name="ge060faccbbeca802afe86be2f4d5b485"></a><!-- doxytag: member="fat16.c::fat16_delete_file" ref="ge060faccbbeca802afe86be2f4d5b485" args="(struct fat16_fs_struct *fs, struct fat16_dir_entry_struct *dir_entry)" -->
326 <div class="memitem">
327 <div class="memproto">
328 <table class="memname">
329 <tr>
330 <td class="memname">uint8_t fat16_delete_file </td>
331 <td>(</td>
332 <td class="paramtype">struct fat16_fs_struct *&nbsp;</td>
333 <td class="paramname"> <em>fs</em>, </td>
334 </tr>
335 <tr>
336 <td class="paramkey"></td>
337 <td></td>
338 <td class="paramtype">struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
339 <td class="paramname"> <em>dir_entry</em></td><td>&nbsp;</td>
340 </tr>
341 <tr>
342 <td></td>
343 <td>)</td>
344 <td></td><td></td><td width="100%"></td>
345 </tr>
346 </table>
347 </div>
348 <div class="memdoc">
349  
350 <p>
351 Deletes a file or directory.
352 <p>
353 If a directory is deleted without first deleting its subdirectories and files, disk space occupied by these files will get wasted as there is no chance to release it and mark it as free.<p>
354 <dl compact><dt><b>Parameters:</b></dt><dd>
355 <table border="0" cellspacing="2" cellpadding="0">
356 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>fs</em>&nbsp;</td><td>The filesystem on which to operate. </td></tr>
357 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dir_entry</em>&nbsp;</td><td>The directory entry of the file to delete. </td></tr>
358 </table>
359 </dl>
360 <dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
361 <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#gf8029e3ec633902d08e8204d13afc350" title="Creates a file.">fat16_create_file</a> </dd></dl>
362  
363 </div>
364 </div><p>
365 <a class="anchor" name="g0045fe378de2f7c52b528f985e1891a6"></a><!-- doxytag: member="fat16.c::fat16_get_dir_entry_of_path" ref="g0045fe378de2f7c52b528f985e1891a6" args="(struct fat16_fs_struct *fs, const char *path, struct fat16_dir_entry_struct *dir_entry)" -->
366 <div class="memitem">
367 <div class="memproto">
368 <table class="memname">
369 <tr>
370 <td class="memname">uint8_t fat16_get_dir_entry_of_path </td>
371 <td>(</td>
372 <td class="paramtype">struct fat16_fs_struct *&nbsp;</td>
373 <td class="paramname"> <em>fs</em>, </td>
374 </tr>
375 <tr>
376 <td class="paramkey"></td>
377 <td></td>
378 <td class="paramtype">const char *&nbsp;</td>
379 <td class="paramname"> <em>path</em>, </td>
380 </tr>
381 <tr>
382 <td class="paramkey"></td>
383 <td></td>
384 <td class="paramtype">struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
385 <td class="paramname"> <em>dir_entry</em></td><td>&nbsp;</td>
386 </tr>
387 <tr>
388 <td></td>
389 <td>)</td>
390 <td></td><td></td><td width="100%"></td>
391 </tr>
392 </table>
393 </div>
394 <div class="memdoc">
395  
396 <p>
397 Retrieves the directory entry of a path.
398 <p>
399 The given path may both describe a file or a directory.<p>
400 <dl compact><dt><b>Parameters:</b></dt><dd>
401 <table border="0" cellspacing="2" cellpadding="0">
402 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>fs</em>&nbsp;</td><td>The FAT16 filesystem on which to search. </td></tr>
403 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>path</em>&nbsp;</td><td>The path of which to read the directory entry. </td></tr>
404 <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>dir_entry</em>&nbsp;</td><td>The directory entry to fill. </td></tr>
405 </table>
406 </dl>
407 <dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
408 <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#g73c8f0598e8224736b09644c48cf2970" title="Reads the next directory entry contained within a parent directory.">fat16_read_dir</a> </dd></dl>
409  
410 </div>
411 </div><p>
412 <a class="anchor" name="g82c7347c5b3cd8832633d5303552eb38"></a><!-- doxytag: member="fat16.c::fat16_get_file_modification_date" ref="g82c7347c5b3cd8832633d5303552eb38" args="(const struct fat16_dir_entry_struct *dir_entry, uint16_t *year, uint8_t *month, uint8_t *day)" -->
413 <div class="memitem">
414 <div class="memproto">
415 <table class="memname">
416 <tr>
417 <td class="memname">void fat16_get_file_modification_date </td>
418 <td>(</td>
419 <td class="paramtype">const struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
420 <td class="paramname"> <em>dir_entry</em>, </td>
421 </tr>
422 <tr>
423 <td class="paramkey"></td>
424 <td></td>
425 <td class="paramtype">uint16_t *&nbsp;</td>
426 <td class="paramname"> <em>year</em>, </td>
427 </tr>
428 <tr>
429 <td class="paramkey"></td>
430 <td></td>
431 <td class="paramtype">uint8_t *&nbsp;</td>
432 <td class="paramname"> <em>month</em>, </td>
433 </tr>
434 <tr>
435 <td class="paramkey"></td>
436 <td></td>
437 <td class="paramtype">uint8_t *&nbsp;</td>
438 <td class="paramname"> <em>day</em></td><td>&nbsp;</td>
439 </tr>
440 <tr>
441 <td></td>
442 <td>)</td>
443 <td></td><td></td><td width="100%"></td>
444 </tr>
445 </table>
446 </div>
447 <div class="memdoc">
448  
449 <p>
450 Returns the modification date of a file.
451 <p>
452 <dl compact><dt><b>Parameters:</b></dt><dd>
453 <table border="0" cellspacing="2" cellpadding="0">
454 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dir_entry</em>&nbsp;</td><td>The directory entry of which to return the modification date. </td></tr>
455 <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>year</em>&nbsp;</td><td>The year the file was last modified. </td></tr>
456 <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>month</em>&nbsp;</td><td>The month the file was last modified. </td></tr>
457 <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>day</em>&nbsp;</td><td>The day the file was last modified. </td></tr>
458 </table>
459 </dl>
460  
461 </div>
462 </div><p>
463 <a class="anchor" name="g5040fcab753ef55337292daf8c0d6784"></a><!-- doxytag: member="fat16.c::fat16_get_file_modification_time" ref="g5040fcab753ef55337292daf8c0d6784" args="(const struct fat16_dir_entry_struct *dir_entry, uint8_t *hour, uint8_t *min, uint8_t *sec)" -->
464 <div class="memitem">
465 <div class="memproto">
466 <table class="memname">
467 <tr>
468 <td class="memname">void fat16_get_file_modification_time </td>
469 <td>(</td>
470 <td class="paramtype">const struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
471 <td class="paramname"> <em>dir_entry</em>, </td>
472 </tr>
473 <tr>
474 <td class="paramkey"></td>
475 <td></td>
476 <td class="paramtype">uint8_t *&nbsp;</td>
477 <td class="paramname"> <em>hour</em>, </td>
478 </tr>
479 <tr>
480 <td class="paramkey"></td>
481 <td></td>
482 <td class="paramtype">uint8_t *&nbsp;</td>
483 <td class="paramname"> <em>min</em>, </td>
484 </tr>
485 <tr>
486 <td class="paramkey"></td>
487 <td></td>
488 <td class="paramtype">uint8_t *&nbsp;</td>
489 <td class="paramname"> <em>sec</em></td><td>&nbsp;</td>
490 </tr>
491 <tr>
492 <td></td>
493 <td>)</td>
494 <td></td><td></td><td width="100%"></td>
495 </tr>
496 </table>
497 </div>
498 <div class="memdoc">
499  
500 <p>
501 Returns the modification time of a file.
502 <p>
503 <dl compact><dt><b>Parameters:</b></dt><dd>
504 <table border="0" cellspacing="2" cellpadding="0">
505 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dir_entry</em>&nbsp;</td><td>The directory entry of which to return the modification time. </td></tr>
506 <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>hour</em>&nbsp;</td><td>The hour the file was last modified. </td></tr>
507 <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>min</em>&nbsp;</td><td>The min the file was last modified. </td></tr>
508 <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>sec</em>&nbsp;</td><td>The sec the file was last modified. </td></tr>
509 </table>
510 </dl>
511  
512 </div>
513 </div><p>
514 <a class="anchor" name="g3a43c9943251749978645ad8e3f16757"></a><!-- doxytag: member="fat16.c::fat16_open_file" ref="g3a43c9943251749978645ad8e3f16757" args="(struct fat16_fs_struct *fs, const struct fat16_dir_entry_struct *dir_entry)" -->
515 <div class="memitem">
516 <div class="memproto">
517 <table class="memname">
518 <tr>
519 <td class="memname">struct fat16_file_struct* fat16_open_file </td>
520 <td>(</td>
521 <td class="paramtype">struct fat16_fs_struct *&nbsp;</td>
522 <td class="paramname"> <em>fs</em>, </td>
523 </tr>
524 <tr>
525 <td class="paramkey"></td>
526 <td></td>
527 <td class="paramtype">const struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
528 <td class="paramname"> <em>dir_entry</em></td><td>&nbsp;</td>
529 </tr>
530 <tr>
531 <td></td>
532 <td>)</td>
533 <td></td><td></td><td width="100%"><code> [read]</code></td>
534 </tr>
535 </table>
536 </div>
537 <div class="memdoc">
538  
539 <p>
540 Opens a file on a FAT16 filesystem.
541 <p>
542 <dl compact><dt><b>Parameters:</b></dt><dd>
543 <table border="0" cellspacing="2" cellpadding="0">
544 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>fs</em>&nbsp;</td><td>The filesystem on which the file to open lies. </td></tr>
545 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dir_entry</em>&nbsp;</td><td>The directory entry of the file to open. </td></tr>
546 </table>
547 </dl>
548 <dl class="return" compact><dt><b>Returns:</b></dt><dd>The file handle, or 0 on failure. </dd></dl>
549 <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#g2b2812041f489bc7913bfa5cbcf0172b" title="Closes a file.">fat16_close_file</a> </dd></dl>
550  
551 </div>
552 </div><p>
553 <a class="anchor" name="g0af2ef3d690626a5640a334cefbb27a6"></a><!-- doxytag: member="fat16.c::fat16_read_file" ref="g0af2ef3d690626a5640a334cefbb27a6" args="(struct fat16_file_struct *fd, uint8_t *buffer, uint16_t buffer_len)" -->
554 <div class="memitem">
555 <div class="memproto">
556 <table class="memname">
557 <tr>
558 <td class="memname">int16_t fat16_read_file </td>
559 <td>(</td>
560 <td class="paramtype">struct fat16_file_struct *&nbsp;</td>
561 <td class="paramname"> <em>fd</em>, </td>
562 </tr>
563 <tr>
564 <td class="paramkey"></td>
565 <td></td>
566 <td class="paramtype">uint8_t *&nbsp;</td>
567 <td class="paramname"> <em>buffer</em>, </td>
568 </tr>
569 <tr>
570 <td class="paramkey"></td>
571 <td></td>
572 <td class="paramtype">uint16_t&nbsp;</td>
573 <td class="paramname"> <em>buffer_len</em></td><td>&nbsp;</td>
574 </tr>
575 <tr>
576 <td></td>
577 <td>)</td>
578 <td></td><td></td><td width="100%"></td>
579 </tr>
580 </table>
581 </div>
582 <div class="memdoc">
583  
584 <p>
585 Reads data from a file.
586 <p>
587 The data requested is read from the current file location.<p>
588 <dl compact><dt><b>Parameters:</b></dt><dd>
589 <table border="0" cellspacing="2" cellpadding="0">
590 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>fd</em>&nbsp;</td><td>The file handle of the file from which to read. </td></tr>
591 <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>buffer</em>&nbsp;</td><td>The buffer into which to write. </td></tr>
592 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>buffer_len</em>&nbsp;</td><td>The amount of data to read. </td></tr>
593 </table>
594 </dl>
595 <dl class="return" compact><dt><b>Returns:</b></dt><dd>The number of bytes read, 0 on end of file, or -1 on failure. </dd></dl>
596 <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#g4f0c785a47b1cf070839b5edec2c6f65" title="Writes data to a file.">fat16_write_file</a> </dd></dl>
597  
598 </div>
599 </div><p>
600 <a class="anchor" name="g23740742fa60ca148ef098caac7085c0"></a><!-- doxytag: member="fat16.c::fat16_resize_file" ref="g23740742fa60ca148ef098caac7085c0" args="(struct fat16_file_struct *fd, uint32_t size)" -->
601 <div class="memitem">
602 <div class="memproto">
603 <table class="memname">
604 <tr>
605 <td class="memname">uint8_t fat16_resize_file </td>
606 <td>(</td>
607 <td class="paramtype">struct fat16_file_struct *&nbsp;</td>
608 <td class="paramname"> <em>fd</em>, </td>
609 </tr>
610 <tr>
611 <td class="paramkey"></td>
612 <td></td>
613 <td class="paramtype">uint32_t&nbsp;</td>
614 <td class="paramname"> <em>size</em></td><td>&nbsp;</td>
615 </tr>
616 <tr>
617 <td></td>
618 <td>)</td>
619 <td></td><td></td><td width="100%"></td>
620 </tr>
621 </table>
622 </div>
623 <div class="memdoc">
624  
625 <p>
626 Resizes a file to have a specific size.
627 <p>
628 Enlarges or shrinks the file pointed to by the file descriptor to have exactly the specified size.<p>
629 If the file is truncated, all bytes having an equal or larger offset than the given size are lost. If the file is expanded, the additional bytes are allocated.<p>
630 <dl class="note" compact><dt><b>Note:</b></dt><dd>Please be aware that this function just allocates or deallocates disk space, it does not explicitely clear it. To avoid data leakage, this must be done manually.</dd></dl>
631 <dl compact><dt><b>Parameters:</b></dt><dd>
632 <table border="0" cellspacing="2" cellpadding="0">
633 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>fd</em>&nbsp;</td><td>The file decriptor of the file which to resize. </td></tr>
634 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>size</em>&nbsp;</td><td>The new size of the file. </td></tr>
635 </table>
636 </dl>
637 <dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
638  
639 </div>
640 </div><p>
641 <a class="anchor" name="gf1511fd1a5419d0828265566dc5d33e4"></a><!-- doxytag: member="fat16.c::fat16_seek_file" ref="gf1511fd1a5419d0828265566dc5d33e4" args="(struct fat16_file_struct *fd, int32_t *offset, uint8_t whence)" -->
642 <div class="memitem">
643 <div class="memproto">
644 <table class="memname">
645 <tr>
646 <td class="memname">uint8_t fat16_seek_file </td>
647 <td>(</td>
648 <td class="paramtype">struct fat16_file_struct *&nbsp;</td>
649 <td class="paramname"> <em>fd</em>, </td>
650 </tr>
651 <tr>
652 <td class="paramkey"></td>
653 <td></td>
654 <td class="paramtype">int32_t *&nbsp;</td>
655 <td class="paramname"> <em>offset</em>, </td>
656 </tr>
657 <tr>
658 <td class="paramkey"></td>
659 <td></td>
660 <td class="paramtype">uint8_t&nbsp;</td>
661 <td class="paramname"> <em>whence</em></td><td>&nbsp;</td>
662 </tr>
663 <tr>
664 <td></td>
665 <td>)</td>
666 <td></td><td></td><td width="100%"></td>
667 </tr>
668 </table>
669 </div>
670 <div class="memdoc">
671  
672 <p>
673 Repositions the read/write file offset.
674 <p>
675 Changes the file offset where the next call to <a class="el" href="group__fat16__file.html#g0af2ef3d690626a5640a334cefbb27a6" title="Reads data from a file.">fat16_read_file()</a> or <a class="el" href="group__fat16__file.html#g4f0c785a47b1cf070839b5edec2c6f65" title="Writes data to a file.">fat16_write_file()</a> starts reading/writing.<p>
676 If the new offset is beyond the end of the file, <a class="el" href="group__fat16__file.html#g23740742fa60ca148ef098caac7085c0" title="Resizes a file to have a specific size.">fat16_resize_file()</a> is implicitly called, i.e. the file is expanded.<p>
677 The new offset can be given in different ways determined by the <code>whence</code> parameter:<ul>
678 <li><b>FAT16_SEEK_SET:</b> <code>*offset</code> is relative to the beginning of the file.</li><li><b>FAT16_SEEK_CUR:</b> <code>*offset</code> is relative to the current file position.</li><li><b>FAT16_SEEK_END:</b> <code>*offset</code> is relative to the end of the file.</li></ul>
679 <p>
680 The resulting absolute offset is written to the location the <code>offset</code> parameter points to.<p>
681 <dl compact><dt><b>Parameters:</b></dt><dd>
682 <table border="0" cellspacing="2" cellpadding="0">
683 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>fd</em>&nbsp;</td><td>The file decriptor of the file on which to seek. </td></tr>
684 <tr><td valign="top"><tt>[in,out]</tt>&nbsp;</td><td valign="top"><em>offset</em>&nbsp;</td><td>A pointer to the new offset, as affected by the <code>whence</code> parameter. The function writes the new absolute offset to this location before it returns. </td></tr>
685 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>whence</em>&nbsp;</td><td>Affects the way <code>offset</code> is interpreted, see above. </td></tr>
686 </table>
687 </dl>
688 <dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
689  
690 </div>
691 </div><p>
692 <a class="anchor" name="g4f0c785a47b1cf070839b5edec2c6f65"></a><!-- doxytag: member="fat16.c::fat16_write_file" ref="g4f0c785a47b1cf070839b5edec2c6f65" args="(struct fat16_file_struct *fd, const uint8_t *buffer, uint16_t buffer_len)" -->
693 <div class="memitem">
694 <div class="memproto">
695 <table class="memname">
696 <tr>
697 <td class="memname">int16_t fat16_write_file </td>
698 <td>(</td>
699 <td class="paramtype">struct fat16_file_struct *&nbsp;</td>
700 <td class="paramname"> <em>fd</em>, </td>
701 </tr>
702 <tr>
703 <td class="paramkey"></td>
704 <td></td>
705 <td class="paramtype">const uint8_t *&nbsp;</td>
706 <td class="paramname"> <em>buffer</em>, </td>
707 </tr>
708 <tr>
709 <td class="paramkey"></td>
710 <td></td>
711 <td class="paramtype">uint16_t&nbsp;</td>
712 <td class="paramname"> <em>buffer_len</em></td><td>&nbsp;</td>
713 </tr>
714 <tr>
715 <td></td>
716 <td>)</td>
717 <td></td><td></td><td width="100%"></td>
718 </tr>
719 </table>
720 </div>
721 <div class="memdoc">
722  
723 <p>
724 Writes data to a file.
725 <p>
726 The data is written to the current file location.<p>
727 <dl compact><dt><b>Parameters:</b></dt><dd>
728 <table border="0" cellspacing="2" cellpadding="0">
729 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>fd</em>&nbsp;</td><td>The file handle of the file to which to write. </td></tr>
730 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>buffer</em>&nbsp;</td><td>The buffer from which to read the data to be written. </td></tr>
731 <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>buffer_len</em>&nbsp;</td><td>The amount of data to write. </td></tr>
732 </table>
733 </dl>
734 <dl class="return" compact><dt><b>Returns:</b></dt><dd>The number of bytes written, 0 on disk full, or -1 on failure. </dd></dl>
735 <dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#g0af2ef3d690626a5640a334cefbb27a6" title="Reads data from a file.">fat16_read_file</a> </dd></dl>
736  
737 </div>
738 </div><p>
739 <hr size="1"><address style="text-align: right;"><small>Generated on Thu Dec 13 19:38:48 2007 for sd-reader by&nbsp;
740 <a href="http://www.doxygen.org/index.html">
741 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3-20071008 </small></address>
742 </body>
743 </html>