ece312/final_project/sd_reader/doc/html/group__fat__file.html

911 lines
48 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>sd-reader: FAT file functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">sd-reader
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Defines</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">FAT file functions</div> </div>
<div class="ingroups"><a class="el" href="group__fat.html">FAT support</a></div></div><!--header-->
<div class="contents">
<p>Functions for managing files.
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Describes a directory entry. <a href="structfat__dir__entry__struct.html#details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#gac404d1380dbf00e8a1d6145e035ef10b">FAT_ATTRIB_READONLY</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The file is read-only. <a href="#gac404d1380dbf00e8a1d6145e035ef10b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#gaaf88f01d19ef4ca777c9c683f458f45f">FAT_ATTRIB_HIDDEN</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The file is hidden. <a href="#gaaf88f01d19ef4ca777c9c683f458f45f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#gae5aa3610233e87e4ca36b2afe3c3854c">FAT_ATTRIB_SYSTEM</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The file is a system file. <a href="#gae5aa3610233e87e4ca36b2afe3c3854c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#ga86f9c93dd409d11813361d48517ccbce">FAT_ATTRIB_VOLUME</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The file is empty and has the volume label as its name. <a href="#ga86f9c93dd409d11813361d48517ccbce"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#gacd38dccfabf884611c62aebc90e5adc7">FAT_ATTRIB_DIR</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The file is a directory. <a href="#gacd38dccfabf884611c62aebc90e5adc7"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#ga18ef7ecd9adce93d49a571882e145c99">FAT_ATTRIB_ARCHIVE</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The file has to be archived. <a href="#ga18ef7ecd9adce93d49a571882e145c99"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#gab870215439192f82ed358e2c7e94ba09">FAT_SEEK_SET</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The given offset is relative to the beginning of the file. <a href="#gab870215439192f82ed358e2c7e94ba09"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#gadba54c574b9a738c8b766ea3b40eeef2">FAT_SEEK_CUR</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The given offset is relative to the current read/write position. <a href="#gadba54c574b9a738c8b766ea3b40eeef2"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#gab34d95851ea8b28646ce25c0e0039bc2">FAT_SEEK_END</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The given offset is relative to the end of the file. <a href="#gab34d95851ea8b28646ce25c0e0039bc2"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#ga033743a7d8878712e0add6d57b750525">fat_get_dir_entry_of_path</a> (struct fat_fs_struct *fs, const char *path, struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieves the directory entry of a path. <a href="#ga033743a7d8878712e0add6d57b750525"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct fat_file_struct *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#ga76a0b06949525b578db04a56d67fbfc4">fat_open_file</a> (struct fat_fs_struct *fs, const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Opens a file on a FAT filesystem. <a href="#ga76a0b06949525b578db04a56d67fbfc4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#ga70b082abb4ebc8d4e9956886901b55fc">fat_close_file</a> (struct fat_file_struct *fd)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Closes a file. <a href="#ga70b082abb4ebc8d4e9956886901b55fc"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">intptr_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#ga48e17b173bede64cb08cef05b88fd0ca">fat_read_file</a> (struct fat_file_struct *fd, uint8_t *buffer, uintptr_t buffer_len)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads data from a file. <a href="#ga48e17b173bede64cb08cef05b88fd0ca"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">intptr_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#ga6782ff80eb6fba9b6ed1a66f33dae60a">fat_write_file</a> (struct fat_file_struct *fd, const uint8_t *buffer, uintptr_t buffer_len)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes data to a file. <a href="#ga6782ff80eb6fba9b6ed1a66f33dae60a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#gad4c305cf004bae9bea48730ed20c87ec">fat_seek_file</a> (struct fat_file_struct *fd, int32_t *offset, uint8_t whence)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Repositions the read/write file offset. <a href="#gad4c305cf004bae9bea48730ed20c87ec"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#gace4858e7a145684f6c8cd14debe14255">fat_resize_file</a> (struct fat_file_struct *fd, uint32_t size)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Resizes a file to have a specific size. <a href="#gace4858e7a145684f6c8cd14debe14255"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#ga9d17d09125359dfb440fc57eede40b4f">fat_create_file</a> (struct fat_dir_struct *parent, const char *file, struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a file. <a href="#ga9d17d09125359dfb440fc57eede40b4f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#ga46055219b942eb8d57ffae9dc6447e7c">fat_delete_file</a> (struct fat_fs_struct *fs, struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Deletes a file or directory. <a href="#ga46055219b942eb8d57ffae9dc6447e7c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#gaba4d2c80ccd8f1aebcecf7072dc37510">fat_move_file</a> (struct fat_fs_struct *fs, struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry, struct fat_dir_struct *parent_new, const char *file_new)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Moves or renames a file. <a href="#gaba4d2c80ccd8f1aebcecf7072dc37510"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#ga24763fd73cbeb580ae5d19e975bde0d8">fat_get_file_modification_date</a> (const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry, uint16_t *year, uint8_t *month, uint8_t *day)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the modification date of a file. <a href="#ga24763fd73cbeb580ae5d19e975bde0d8"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#ga74f840c317556b7dae766e199d87a6ef">fat_get_file_modification_time</a> (const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry, uint8_t *hour, uint8_t *min, uint8_t *sec)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the modification time of a file. <a href="#ga74f840c317556b7dae766e199d87a6ef"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#ga02c969e994a556534c92906db5bb04fd">fat_set_file_modification_date</a> (struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry, uint16_t year, uint8_t month, uint8_t day)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the modification time of a date. <a href="#ga02c969e994a556534c92906db5bb04fd"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat__file.html#gab514f14ce35a38bff3f16270dfdc033b">fat_set_file_modification_time</a> (struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *dir_entry, uint8_t hour, uint8_t min, uint8_t sec)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the modification time of a file. <a href="#gab514f14ce35a38bff3f16270dfdc033b"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>Functions for managing files. </p>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="ga18ef7ecd9adce93d49a571882e145c99"></a><!-- doxytag: member="fat.h::FAT_ATTRIB_ARCHIVE" ref="ga18ef7ecd9adce93d49a571882e145c99" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="group__fat__file.html#ga18ef7ecd9adce93d49a571882e145c99">FAT_ATTRIB_ARCHIVE</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The file has to be archived. </p>
</div>
</div>
<a class="anchor" id="gacd38dccfabf884611c62aebc90e5adc7"></a><!-- doxytag: member="fat.h::FAT_ATTRIB_DIR" ref="gacd38dccfabf884611c62aebc90e5adc7" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="group__fat__file.html#gacd38dccfabf884611c62aebc90e5adc7">FAT_ATTRIB_DIR</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The file is a directory. </p>
</div>
</div>
<a class="anchor" id="gaaf88f01d19ef4ca777c9c683f458f45f"></a><!-- doxytag: member="fat.h::FAT_ATTRIB_HIDDEN" ref="gaaf88f01d19ef4ca777c9c683f458f45f" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="group__fat__file.html#gaaf88f01d19ef4ca777c9c683f458f45f">FAT_ATTRIB_HIDDEN</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The file is hidden. </p>
</div>
</div>
<a class="anchor" id="gac404d1380dbf00e8a1d6145e035ef10b"></a><!-- doxytag: member="fat.h::FAT_ATTRIB_READONLY" ref="gac404d1380dbf00e8a1d6145e035ef10b" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="group__fat__file.html#gac404d1380dbf00e8a1d6145e035ef10b">FAT_ATTRIB_READONLY</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The file is read-only. </p>
</div>
</div>
<a class="anchor" id="gae5aa3610233e87e4ca36b2afe3c3854c"></a><!-- doxytag: member="fat.h::FAT_ATTRIB_SYSTEM" ref="gae5aa3610233e87e4ca36b2afe3c3854c" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="group__fat__file.html#gae5aa3610233e87e4ca36b2afe3c3854c">FAT_ATTRIB_SYSTEM</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The file is a system file. </p>
</div>
</div>
<a class="anchor" id="ga86f9c93dd409d11813361d48517ccbce"></a><!-- doxytag: member="fat.h::FAT_ATTRIB_VOLUME" ref="ga86f9c93dd409d11813361d48517ccbce" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="group__fat__file.html#ga86f9c93dd409d11813361d48517ccbce">FAT_ATTRIB_VOLUME</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The file is empty and has the volume label as its name. </p>
</div>
</div>
<a class="anchor" id="gadba54c574b9a738c8b766ea3b40eeef2"></a><!-- doxytag: member="fat.h::FAT_SEEK_CUR" ref="gadba54c574b9a738c8b766ea3b40eeef2" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="group__fat__file.html#gadba54c574b9a738c8b766ea3b40eeef2">FAT_SEEK_CUR</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The given offset is relative to the current read/write position. </p>
</div>
</div>
<a class="anchor" id="gab34d95851ea8b28646ce25c0e0039bc2"></a><!-- doxytag: member="fat.h::FAT_SEEK_END" ref="gab34d95851ea8b28646ce25c0e0039bc2" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="group__fat__file.html#gab34d95851ea8b28646ce25c0e0039bc2">FAT_SEEK_END</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The given offset is relative to the end of the file. </p>
</div>
</div>
<a class="anchor" id="gab870215439192f82ed358e2c7e94ba09"></a><!-- doxytag: member="fat.h::FAT_SEEK_SET" ref="gab870215439192f82ed358e2c7e94ba09" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define <a class="el" href="group__fat__file.html#gab870215439192f82ed358e2c7e94ba09">FAT_SEEK_SET</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The given offset is relative to the beginning of the file. </p>
</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga70b082abb4ebc8d4e9956886901b55fc"></a><!-- doxytag: member="fat.c::fat_close_file" ref="ga70b082abb4ebc8d4e9956886901b55fc" args="(struct fat_file_struct *fd)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="group__fat.html#ga70b082abb4ebc8d4e9956886901b55fc">fat_close_file</a> </td>
<td>(</td>
<td class="paramtype">struct fat_file_struct *&#160;</td>
<td class="paramname"><em>fd</em></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Closes a file. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fd</td><td>The file handle of the file to close. </td></tr>
</table>
</dd>
</dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga76a0b06949525b578db04a56d67fbfc4" title="Opens a file on a FAT filesystem.">fat_open_file</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga9d17d09125359dfb440fc57eede40b4f"></a><!-- doxytag: member="fat.c::fat_create_file" ref="ga9d17d09125359dfb440fc57eede40b4f" args="(struct fat_dir_struct *parent, const char *file, struct fat_dir_entry_struct *dir_entry)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t <a class="el" href="group__fat.html#ga9d17d09125359dfb440fc57eede40b4f">fat_create_file</a> </td>
<td>(</td>
<td class="paramtype">struct fat_dir_struct *&#160;</td>
<td class="paramname"><em>parent</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>file</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *&#160;</td>
<td class="paramname"><em>dir_entry</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Creates a file. </p>
<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 class="note"><dt><b>Note:</b></dt><dd>The file name is not checked for invalid characters.</dd>
<dd>
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 class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">parent</td><td>The handle of the directory in which to create the file. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">file</td><td>The name of the file to create. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">dir_entry</td><td>The directory entry to fill for the new (or existing) file. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success, 2 if the file already existed. </dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga46055219b942eb8d57ffae9dc6447e7c" title="Deletes a file or directory.">fat_delete_file</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga46055219b942eb8d57ffae9dc6447e7c"></a><!-- doxytag: member="fat.c::fat_delete_file" ref="ga46055219b942eb8d57ffae9dc6447e7c" args="(struct fat_fs_struct *fs, struct fat_dir_entry_struct *dir_entry)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t <a class="el" href="group__fat.html#ga46055219b942eb8d57ffae9dc6447e7c">fat_delete_file</a> </td>
<td>(</td>
<td class="paramtype">struct fat_fs_struct *&#160;</td>
<td class="paramname"><em>fs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *&#160;</td>
<td class="paramname"><em>dir_entry</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Deletes a file or directory. </p>
<p>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>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>The filesystem on which to operate. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dir_entry</td><td>The directory entry of the file to delete. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga9d17d09125359dfb440fc57eede40b4f" title="Creates a file.">fat_create_file</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga033743a7d8878712e0add6d57b750525"></a><!-- doxytag: member="fat.c::fat_get_dir_entry_of_path" ref="ga033743a7d8878712e0add6d57b750525" args="(struct fat_fs_struct *fs, const char *path, struct fat_dir_entry_struct *dir_entry)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t <a class="el" href="group__fat.html#ga033743a7d8878712e0add6d57b750525">fat_get_dir_entry_of_path</a> </td>
<td>(</td>
<td class="paramtype">struct fat_fs_struct *&#160;</td>
<td class="paramname"><em>fs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>path</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *&#160;</td>
<td class="paramname"><em>dir_entry</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Retrieves the directory entry of a path. </p>
<p>The given path may both describe a file or a directory.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>The FAT filesystem on which to search. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">path</td><td>The path of which to read the directory entry. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">dir_entry</td><td>The directory entry to fill. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#gab4bc79452dbf5ac2a2f3e1fccafd9534" title="Reads the next directory entry contained within a parent directory.">fat_read_dir</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga24763fd73cbeb580ae5d19e975bde0d8"></a><!-- doxytag: member="fat.c::fat_get_file_modification_date" ref="ga24763fd73cbeb580ae5d19e975bde0d8" args="(const struct fat_dir_entry_struct *dir_entry, uint16_t *year, uint8_t *month, uint8_t *day)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="group__fat.html#ga24763fd73cbeb580ae5d19e975bde0d8">fat_get_file_modification_date</a> </td>
<td>(</td>
<td class="paramtype">const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *&#160;</td>
<td class="paramname"><em>dir_entry</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t *&#160;</td>
<td class="paramname"><em>year</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>month</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>day</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the modification date of a file. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">dir_entry</td><td>The directory entry of which to return the modification date. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">year</td><td>The year the file was last modified. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">month</td><td>The month the file was last modified. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">day</td><td>The day the file was last modified. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga74f840c317556b7dae766e199d87a6ef"></a><!-- doxytag: member="fat.c::fat_get_file_modification_time" ref="ga74f840c317556b7dae766e199d87a6ef" args="(const struct fat_dir_entry_struct *dir_entry, uint8_t *hour, uint8_t *min, uint8_t *sec)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="group__fat.html#ga74f840c317556b7dae766e199d87a6ef">fat_get_file_modification_time</a> </td>
<td>(</td>
<td class="paramtype">const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *&#160;</td>
<td class="paramname"><em>dir_entry</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>hour</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>min</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>sec</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Returns the modification time of a file. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">dir_entry</td><td>The directory entry of which to return the modification time. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">hour</td><td>The hour the file was last modified. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">min</td><td>The min the file was last modified. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">sec</td><td>The sec the file was last modified. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gaba4d2c80ccd8f1aebcecf7072dc37510"></a><!-- doxytag: member="fat.c::fat_move_file" ref="gaba4d2c80ccd8f1aebcecf7072dc37510" args="(struct fat_fs_struct *fs, struct fat_dir_entry_struct *dir_entry, struct fat_dir_struct *parent_new, const char *file_new)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t <a class="el" href="group__fat.html#gaba4d2c80ccd8f1aebcecf7072dc37510">fat_move_file</a> </td>
<td>(</td>
<td class="paramtype">struct fat_fs_struct *&#160;</td>
<td class="paramname"><em>fs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *&#160;</td>
<td class="paramname"><em>dir_entry</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">struct fat_dir_struct *&#160;</td>
<td class="paramname"><em>parent_new</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>file_new</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Moves or renames a file. </p>
<p>Changes a file's name, optionally moving it into another directory as well. Before calling this function, the target file name must not exist. Moving a file to a different filesystem (i.e. <em>parent_new</em> doesn't lie on <em>fs</em>) is not supported.</p>
<p>After successfully renaming (and moving) the file, the given directory entry is updated such that it points to the file's new location.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>The notes which apply to <a class="el" href="group__fat__file.html#ga9d17d09125359dfb440fc57eede40b4f" title="Creates a file.">fat_create_file()</a> also apply to this function.</dd></dl>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>The filesystem on which to operate. </td></tr>
<tr><td class="paramdir">[in,out]</td><td class="paramname">dir_entry</td><td>The directory entry of the file to move. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">parent_new</td><td>The handle of the new parent directory of the file. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">file_new</td><td>The file's new name. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga9d17d09125359dfb440fc57eede40b4f" title="Creates a file.">fat_create_file</a>, <a class="el" href="group__fat.html#ga46055219b942eb8d57ffae9dc6447e7c" title="Deletes a file or directory.">fat_delete_file</a>, <a class="el" href="group__fat__dir.html#ga8c448f10b372823ce01b39fefb0679b9" title="Moves or renames a directory.">fat_move_dir</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga76a0b06949525b578db04a56d67fbfc4"></a><!-- doxytag: member="fat.c::fat_open_file" ref="ga76a0b06949525b578db04a56d67fbfc4" args="(struct fat_fs_struct *fs, const struct fat_dir_entry_struct *dir_entry)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">struct fat_file_struct* <a class="el" href="group__fat.html#ga76a0b06949525b578db04a56d67fbfc4">fat_open_file</a> </td>
<td>(</td>
<td class="paramtype">struct fat_fs_struct *&#160;</td>
<td class="paramname"><em>fs</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *&#160;</td>
<td class="paramname"><em>dir_entry</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [read]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Opens a file on a FAT filesystem. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fs</td><td>The filesystem on which the file to open lies. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">dir_entry</td><td>The directory entry of the file to open. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The file handle, or 0 on failure. </dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga70b082abb4ebc8d4e9956886901b55fc" title="Closes a file.">fat_close_file</a> </dd></dl>
</div>
</div>
<a class="anchor" id="ga48e17b173bede64cb08cef05b88fd0ca"></a><!-- doxytag: member="fat.c::fat_read_file" ref="ga48e17b173bede64cb08cef05b88fd0ca" 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 <a class="el" href="group__fat.html#ga48e17b173bede64cb08cef05b88fd0ca">fat_read_file</a> </td>
<td>(</td>
<td class="paramtype">struct fat_file_struct *&#160;</td>
<td class="paramname"><em>fd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *&#160;</td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uintptr_t&#160;</td>
<td class="paramname"><em>buffer_len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Reads data from a file. </p>
<p>The data requested is read from the current file location.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fd</td><td>The file handle of the file from which to read. </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">buffer</td><td>The buffer into which to write. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">buffer_len</td><td>The amount of data to read. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><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"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga6782ff80eb6fba9b6ed1a66f33dae60a" title="Writes data to a file.">fat_write_file</a> </dd></dl>
</div>
</div>
<a class="anchor" id="gace4858e7a145684f6c8cd14debe14255"></a><!-- doxytag: member="fat.c::fat_resize_file" ref="gace4858e7a145684f6c8cd14debe14255" args="(struct fat_file_struct *fd, uint32_t size)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint8_t <a class="el" href="group__fat.html#gace4858e7a145684f6c8cd14debe14255">fat_resize_file</a> </td>
<td>(</td>
<td class="paramtype">struct fat_file_struct *&#160;</td>
<td class="paramname"><em>fd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Resizes a file to have a specific size. </p>
<p>Enlarges or shrinks the file pointed to by the file descriptor to have exactly the specified size.</p>
<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"><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 class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fd</td><td>The file decriptor of the file which to resize. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">size</td><td>The new size of the file. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
</div>
</div>
<a class="anchor" id="gad4c305cf004bae9bea48730ed20c87ec"></a><!-- doxytag: member="fat.c::fat_seek_file" ref="gad4c305cf004bae9bea48730ed20c87ec" 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 <a class="el" href="group__fat.html#gad4c305cf004bae9bea48730ed20c87ec">fat_seek_file</a> </td>
<td>(</td>
<td class="paramtype">struct fat_file_struct *&#160;</td>
<td class="paramname"><em>fd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int32_t *&#160;</td>
<td class="paramname"><em>offset</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>whence</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Repositions the read/write file offset. </p>
<p>Changes the file offset where the next call to <a class="el" href="group__fat__file.html#ga48e17b173bede64cb08cef05b88fd0ca" title="Reads data from a file.">fat_read_file()</a> or <a class="el" href="group__fat__file.html#ga6782ff80eb6fba9b6ed1a66f33dae60a" title="Writes data to a file.">fat_write_file()</a> starts reading/writing.</p>
<p>If the new offset is beyond the end of the file, <a class="el" href="group__fat__file.html#gace4858e7a145684f6c8cd14debe14255" title="Resizes a file to have a specific size.">fat_resize_file()</a> is implicitly called, i.e. the file is expanded.</p>
<p>The new offset can be given in different ways determined by the <code>whence</code> parameter:</p>
<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>
<p>Calling this function can also be used to retrieve the current file position: </p>
<div class="fragment"><pre class="fragment"> int32_t file_pos = 0;
<span class="keywordflow">if</span>(!<a class="code" href="group__fat__file.html#gad4c305cf004bae9bea48730ed20c87ec" title="Repositions the read/write file offset.">fat_seek_file</a>(fd, &amp;file_pos, <a class="code" href="group__fat__file.html#gadba54c574b9a738c8b766ea3b40eeef2" title="The given offset is relative to the current read/write position.">FAT_SEEK_CUR</a>))
{
<span class="comment">// error</span>
}
<span class="comment">// file_pos now contains the absolute file position</span>
</pre></div><dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fd</td><td>The file decriptor of the file on which to seek. </td></tr>
<tr><td class="paramdir">[in,out]</td><td class="paramname">offset</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 class="paramdir">[in]</td><td class="paramname">whence</td><td>Affects the way <code>offset</code> is interpreted, see above. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on failure, 1 on success. </dd></dl>
</div>
</div>
<a class="anchor" id="ga02c969e994a556534c92906db5bb04fd"></a><!-- doxytag: member="fat.c::fat_set_file_modification_date" ref="ga02c969e994a556534c92906db5bb04fd" args="(struct fat_dir_entry_struct *dir_entry, uint16_t year, uint8_t month, uint8_t day)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="group__fat__file.html#ga02c969e994a556534c92906db5bb04fd">fat_set_file_modification_date</a> </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *&#160;</td>
<td class="paramname"><em>dir_entry</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t&#160;</td>
<td class="paramname"><em>year</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>month</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>day</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Sets the modification time of a date. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">dir_entry</td><td>The directory entry for which to set the modification date. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">year</td><td>The year the file was last modified. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">month</td><td>The month the file was last modified. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">day</td><td>The day the file was last modified. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gab514f14ce35a38bff3f16270dfdc033b"></a><!-- doxytag: member="fat.c::fat_set_file_modification_time" ref="gab514f14ce35a38bff3f16270dfdc033b" args="(struct fat_dir_entry_struct *dir_entry, uint8_t hour, uint8_t min, uint8_t sec)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="group__fat__file.html#gab514f14ce35a38bff3f16270dfdc033b">fat_set_file_modification_time</a> </td>
<td>(</td>
<td class="paramtype">struct <a class="el" href="structfat__dir__entry__struct.html">fat_dir_entry_struct</a> *&#160;</td>
<td class="paramname"><em>dir_entry</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>hour</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>min</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>sec</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Sets the modification time of a file. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">dir_entry</td><td>The directory entry for which to set the modification time. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">hour</td><td>The year the file was last modified. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">min</td><td>The month the file was last modified. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">sec</td><td>The day the file was last modified. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga6782ff80eb6fba9b6ed1a66f33dae60a"></a><!-- doxytag: member="fat.c::fat_write_file" ref="ga6782ff80eb6fba9b6ed1a66f33dae60a" 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 <a class="el" href="group__fat.html#ga6782ff80eb6fba9b6ed1a66f33dae60a">fat_write_file</a> </td>
<td>(</td>
<td class="paramtype">struct fat_file_struct *&#160;</td>
<td class="paramname"><em>fd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t *&#160;</td>
<td class="paramname"><em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uintptr_t&#160;</td>
<td class="paramname"><em>buffer_len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Writes data to a file. </p>
<p>The data is written to the current file location.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">fd</td><td>The file handle of the file to which to write. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">buffer</td><td>The buffer from which to read the data to be written. </td></tr>
<tr><td class="paramdir">[in]</td><td class="paramname">buffer_len</td><td>The amount of data to write. </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The number of bytes written (0 or something less than <code>buffer_len</code> on disk full) or -1 on failure. </dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group__fat.html#ga48e17b173bede64cb08cef05b88fd0ca" title="Reads data from a file.">fat_read_file</a> </dd></dl>
</div>
</div>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Jun 12 2012 20:06:45 for sd-reader by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
</body>
</html>