📄 group__fat16__file.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>sd-reader: FAT16 file functions</title><link href="doxygen.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.6 --><div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul></div><h1>FAT16 file functions<br><small>[<a class="el" href="group__fat16.html">FAT16 support</a>]</small></h1><hr><a name="_details"></a><h2>Detailed Description</h2>Functions for managing files. <p><p><table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr><tr><td colspan="2"><br><h2>Data Structures</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">Describes a directory entry. <a href="structfat16__dir__entry__struct.html#_details">More...</a><br></td></tr><tr><td colspan="2"><br><h2>Defines</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g1c4ea0b6e1087b1a88d26b8942c5d923"></a><!-- doxytag: member="fat16_file::FAT16_ATTRIB_READONLY" ref="g1c4ea0b6e1087b1a88d26b8942c5d923" args="" -->#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g1c4ea0b6e1087b1a88d26b8942c5d923">FAT16_ATTRIB_READONLY</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">The file is read-only. <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g229780f6a88ab775ea82264c9f1e0616"></a><!-- doxytag: member="fat16_file::FAT16_ATTRIB_HIDDEN" ref="g229780f6a88ab775ea82264c9f1e0616" args="" -->#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g229780f6a88ab775ea82264c9f1e0616">FAT16_ATTRIB_HIDDEN</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">The file is hidden. <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga0badbbc92da7601b4a51d99ba7e8f8f"></a><!-- doxytag: member="fat16_file::FAT16_ATTRIB_SYSTEM" ref="ga0badbbc92da7601b4a51d99ba7e8f8f" args="" -->#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#ga0badbbc92da7601b4a51d99ba7e8f8f">FAT16_ATTRIB_SYSTEM</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">The file is a system file. <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gc1341eb7b40d2f48cacf9b9d8aedbb6c"></a><!-- doxytag: member="fat16_file::FAT16_ATTRIB_VOLUME" ref="gc1341eb7b40d2f48cacf9b9d8aedbb6c" args="" -->#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#gc1341eb7b40d2f48cacf9b9d8aedbb6c">FAT16_ATTRIB_VOLUME</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">The file is empty and has the volume label as its name. <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gafdb0e859960ff33b11b6c55b3188274"></a><!-- doxytag: member="fat16_file::FAT16_ATTRIB_DIR" ref="gafdb0e859960ff33b11b6c55b3188274" args="" -->#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#gafdb0e859960ff33b11b6c55b3188274">FAT16_ATTRIB_DIR</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">The file is a directory. <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g8e472239ee6baede688a01eaa45551a9"></a><!-- doxytag: member="fat16_file::FAT16_ATTRIB_ARCHIVE" ref="g8e472239ee6baede688a01eaa45551a9" args="" -->#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g8e472239ee6baede688a01eaa45551a9">FAT16_ATTRIB_ARCHIVE</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">The file has to be archived. <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gb90aeb34840c0ea33c8ae9d7577def65"></a><!-- doxytag: member="fat16_file::FAT16_SEEK_SET" ref="gb90aeb34840c0ea33c8ae9d7577def65" args="" -->#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#gb90aeb34840c0ea33c8ae9d7577def65">FAT16_SEEK_SET</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">The given offset is relative to the beginning of the file. <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g432820c6f8c90e11a92efc931c3b8a3a"></a><!-- doxytag: member="fat16_file::FAT16_SEEK_CUR" ref="g432820c6f8c90e11a92efc931c3b8a3a" args="" -->#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g432820c6f8c90e11a92efc931c3b8a3a">FAT16_SEEK_CUR</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">The given offset is relative to the current read/write position. <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g3793e580ccfcd5e68b95a0740c000e39"></a><!-- doxytag: member="fat16_file::FAT16_SEEK_END" ref="g3793e580ccfcd5e68b95a0740c000e39" args="" -->#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html#g3793e580ccfcd5e68b95a0740c000e39">FAT16_SEEK_END</a></td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">The given offset is relative to the end of the file. <br></td></tr><tr><td colspan="2"><br><h2>Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t </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><tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieves the directory entry of a path. <a href="#g0045fe378de2f7c52b528f985e1891a6"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">fat16_file_struct * </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><tr><td class="mdescLeft"> </td><td class="mdescRight">Opens a file on a FAT16 filesystem. <a href="#g3a43c9943251749978645ad8e3f16757"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">void </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><tr><td class="mdescLeft"> </td><td class="mdescRight">Closes a file. <a href="#g2b2812041f489bc7913bfa5cbcf0172b"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">int16_t </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><tr><td class="mdescLeft"> </td><td class="mdescRight">Reads data from a file. <a href="#g0af2ef3d690626a5640a334cefbb27a6"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">int16_t </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><tr><td class="mdescLeft"> </td><td class="mdescRight">Writes data to a file. <a href="#g4f0c785a47b1cf070839b5edec2c6f65"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t </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><tr><td class="mdescLeft"> </td><td class="mdescRight">Repositions the read/write file offset. <a href="#gf1511fd1a5419d0828265566dc5d33e4"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t </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><tr><td class="mdescLeft"> </td><td class="mdescRight">Resizes a file to have a specific size. <a href="#g23740742fa60ca148ef098caac7085c0"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t </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><tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a file. <a href="#gf8029e3ec633902d08e8204d13afc350"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t </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><tr><td class="mdescLeft"> </td><td class="mdescRight">Deletes a file or directory. <a href="#ge060faccbbeca802afe86be2f4d5b485"></a><br></td></tr></table><hr><h2>Function Documentation</h2><a class="anchor" name="g2b2812041f489bc7913bfa5cbcf0172b"></a><!-- doxytag: member="fat16.c::fat16_close_file" ref="g2b2812041f489bc7913bfa5cbcf0172b" args="(struct fat16_file_struct *fd)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">void fat16_close_file </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">struct fat16_file_struct * </td> <td class="mdname1" valign="top" nowrap> <em>fd</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Closes a file. <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 close. </td></tr> </table></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#g3a43c9943251749978645ad8e3f16757">fat16_open_file</a> </dd></dl> </td> </tr></table><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)" --><p><table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">uint8_t fat16_create_file </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">struct fat16_dir_struct * </td> <td class="mdname" nowrap> <em>parent</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>const char * </td> <td class="mdname" nowrap> <em>file</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> * </td> <td class="mdname" nowrap> <em>dir_entry</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Creates a file. <p>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><dl compact><dt><b>Note:</b></dt><dd>The file name is not checked for invalid characters.<p>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><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>parent</em> </td><td>The handle of the directory in which to create the file. </td></tr> <tr><td valign="top"><tt>[in]</tt> </td><td valign="top"><em>file</em> </td><td>The name of the file to create. </td></tr> <tr><td valign="top"><tt>[out]</tt> </td><td valign="top"><em>dir_entry</em> </td><td>The directory entry to fill for the new file. </td></tr> </table></dl><dl compact><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl><dl compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#ge060faccbbeca802afe86be2f4d5b485">fat16_delete_file</a> </dd></dl> </td> </tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -