📄 group__fat.html
字号:
</table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl><dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#g2d74af47cb9fd44f7c974834f810225f" title="Resets a directory handle.">fat_reset_dir</a> </dd></dl></div></div><p><a class="anchor" name="g48e17b173bede64cb08cef05b88fd0ca"></a><!-- doxytag: member="fat.h::fat_read_file" ref="g48e17b173bede64cb08cef05b88fd0ca" args="(struct fat_file_struct *fd, uint8_t *buffer, uintptr_t buffer_len)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">intptr_t fat_read_file </td> <td>(</td> <td class="paramtype">struct fat_file_struct * </td> <td class="paramname"> <em>fd</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint8_t * </td> <td class="paramname"> <em>buffer</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uintptr_t </td> <td class="paramname"> <em>buffer_len</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table></div><div class="memdoc"><p>Reads data from a file. <p>The data requested is read from the current file location.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>fd</em> </td><td>The file handle of the file from which to read. </td></tr> <tr><td valign="top"><tt>[out]</tt> </td><td valign="top"><em>buffer</em> </td><td>The buffer into which to write. </td></tr> <tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>buffer_len</em> </td><td>The amount of data to read. </td></tr> </table></dl><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><dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#g6782ff80eb6fba9b6ed1a66f33dae60a" title="Writes data to a file.">fat_write_file</a> </dd></dl></div></div><p><a class="anchor" name="g2d74af47cb9fd44f7c974834f810225f"></a><!-- doxytag: member="fat.h::fat_reset_dir" ref="g2d74af47cb9fd44f7c974834f810225f" args="(struct fat_dir_struct *dd)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">uint8_t fat_reset_dir </td> <td>(</td> <td class="paramtype">struct fat_dir_struct * </td> <td class="paramname"> <em>dd</em> </td> <td> ) </td> <td></td> </tr> </table></div><div class="memdoc"><p>Resets a directory handle. <p>Resets the directory handle such that reading restarts with the first directory entry.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>dd</em> </td><td>The directory handle to reset. </td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl><dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#gb4bc79452dbf5ac2a2f3e1fccafd9534" title="Reads the next directory entry contained within a parent directory.">fat_read_dir</a> </dd></dl></div></div><p><a class="anchor" name="gce4858e7a145684f6c8cd14debe14255"></a><!-- doxytag: member="fat.h::fat_resize_file" ref="gce4858e7a145684f6c8cd14debe14255" args="(struct fat_file_struct *fd, uint32_t size)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">uint8_t fat_resize_file </td> <td>(</td> <td class="paramtype">struct fat_file_struct * </td> <td class="paramname"> <em>fd</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint32_t </td> <td class="paramname"> <em>size</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table></div><div class="memdoc"><p>Resizes a file to have a specific size. <p>Enlarges or shrinks the file pointed to by the file descriptor to have exactly the specified size.<p>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><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><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>fd</em> </td><td>The file decriptor of the file which to resize. </td></tr> <tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>size</em> </td><td>The new size of the file. </td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl></div></div><p><a class="anchor" name="gd4c305cf004bae9bea48730ed20c87ec"></a><!-- doxytag: member="fat.h::fat_seek_file" ref="gd4c305cf004bae9bea48730ed20c87ec" args="(struct fat_file_struct *fd, int32_t *offset, uint8_t whence)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">uint8_t fat_seek_file </td> <td>(</td> <td class="paramtype">struct fat_file_struct * </td> <td class="paramname"> <em>fd</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int32_t * </td> <td class="paramname"> <em>offset</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uint8_t </td> <td class="paramname"> <em>whence</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table></div><div class="memdoc"><p>Repositions the read/write file offset. <p>Changes the file offset where the next call to <a class="el" href="group__fat__file.html#g48e17b173bede64cb08cef05b88fd0ca" title="Reads data from a file.">fat_read_file()</a> or <a class="el" href="group__fat__file.html#g6782ff80eb6fba9b6ed1a66f33dae60a" title="Writes data to a file.">fat_write_file()</a> starts reading/writing.<p>If the new offset is beyond the end of the file, <a class="el" href="group__fat__file.html#gce4858e7a145684f6c8cd14debe14255" title="Resizes a file to have a specific size.">fat_resize_file()</a> is implicitly called, i.e. the file is expanded.<p>The new offset can be given in different ways determined by the <code>whence</code> parameter:<ul><li><b>FAT_SEEK_SET:</b> <code>*offset</code> is relative to the beginning of the file.</li><li><b>FAT_SEEK_CUR:</b> <code>*offset</code> is relative to the current file position.</li><li><b>FAT_SEEK_END:</b> <code>*offset</code> is relative to the end of the file.</li></ul><p>The resulting absolute offset is written to the location the <code>offset</code> parameter points to.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>fd</em> </td><td>The file decriptor of the file on which to seek. </td></tr> <tr><td valign="top"><tt>[in,out]</tt> </td><td valign="top"><em>offset</em> </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> <tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>whence</em> </td><td>Affects the way <code>offset</code> is interpreted, see above. </td></tr> </table></dl><dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl></div></div><p><a class="anchor" name="g6782ff80eb6fba9b6ed1a66f33dae60a"></a><!-- doxytag: member="fat.h::fat_write_file" ref="g6782ff80eb6fba9b6ed1a66f33dae60a" args="(struct fat_file_struct *fd, const uint8_t *buffer, uintptr_t buffer_len)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">intptr_t fat_write_file </td> <td>(</td> <td class="paramtype">struct fat_file_struct * </td> <td class="paramname"> <em>fd</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const uint8_t * </td> <td class="paramname"> <em>buffer</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">uintptr_t </td> <td class="paramname"> <em>buffer_len</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table></div><div class="memdoc"><p>Writes data to a file. <p>The data is written to the current file location.<p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>fd</em> </td><td>The file handle of the file to which to write. </td></tr> <tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>buffer</em> </td><td>The buffer from which to read the data to be written. </td></tr> <tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>buffer_len</em> </td><td>The amount of data to write. </td></tr> </table></dl><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><dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#g48e17b173bede64cb08cef05b88fd0ca" title="Reads data from a file.">fat_read_file</a> </dd></dl></div></div><p></div><hr size="1"><address style="text-align: right;"><small>Generated on Mon Mar 30 18:27:54 2009 for sd-reader by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -