<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>sd-reader: FAT16 support</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.5.3-20071008 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
  </ul>
</div>
<h1>FAT16 support</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
This module implements FAT16 read and write access. 
<p>
The following features are supported:<ul>
<li>File names up to 31 characters long.</li><li>Unlimited depth of subdirectories.</li><li>Short 8.3 and long filenames.</li><li>Creating and deleting files.</li><li>Reading and writing from and to files.</li><li>File resizing.</li><li>File sizes of up to 4 gigabytes. </li></ul>

<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Files</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fat16_8c.html">fat16.c</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">FAT16 implementation (license: GPLv2 or LGPLv2.1). <br></td></tr>

<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fat16_8h.html">fat16.h</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">FAT16 header (license: GPLv2 or LGPLv2.1). <br></td></tr>

<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="fat16__config_8h.html">fat16_config.h</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">FAT16 configuration (license: GPLv2 or LGPLv2.1). <br></td></tr>

<p>
<tr><td colspan="2"><br><h2>Modules</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__config.html">FAT16 configuration</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Preprocessor defines to configure the FAT16 implementation. <br></td></tr>

<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__fs.html">FAT16 access</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Basic functions for handling a FAT16 filesystem. <br></td></tr>

<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__file.html">FAT16 file functions</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Functions for managing files. <br></td></tr>

<p>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16__dir.html">FAT16 directory functions</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Functions for managing directories. <br></td></tr>

<p>
<tr><td colspan="2"><br><h2>Data Structures</h2></td></tr>
<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>

<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>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">struct fat16_fs_struct *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#gc176ec2f1bfa8c81972ea741a941e579">fat16_open</a> (struct <a class="el" href="structpartition__struct.html">partition_struct</a> *partition)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Opens a FAT16 filesystem.  <a href="#gc176ec2f1bfa8c81972ea741a941e579"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#g6588833571e6ef0f5d094b8ff56a5985">fat16_close</a> (struct fat16_fs_struct *fs)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Closes a FAT16 filesystem.  <a href="#g6588833571e6ef0f5d094b8ff56a5985"></a><br></td></tr>
<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.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">&nbsp;</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&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#g2b2812041f489bc7913bfa5cbcf0172b">fat16_close_file</a> (struct fat16_file_struct *fd)</td></tr>

<tr><td class="mdescLeft">&nbsp;</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&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#g0af2ef3d690626a5640a334cefbb27a6">fat16_read_file</a> (struct fat16_file_struct *fd, uint8_t *buffer, uint16_t buffer_len)</td></tr>

<tr><td class="mdescLeft">&nbsp;</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&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.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">&nbsp;</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&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#gf1511fd1a5419d0828265566dc5d33e4">fat16_seek_file</a> (struct fat16_file_struct *fd, int32_t *offset, uint8_t whence)</td></tr>

<tr><td class="mdescLeft">&nbsp;</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&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#g23740742fa60ca148ef098caac7085c0">fat16_resize_file</a> (struct fat16_file_struct *fd, uint32_t size)</td></tr>

<tr><td class="mdescLeft">&nbsp;</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">struct fat16_dir_struct *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#g9704120fef030632a76d91cfbbef78b0">fat16_open_dir</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">&nbsp;</td><td class="mdescRight">Opens a directory.  <a href="#g9704120fef030632a76d91cfbbef78b0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#g95f491a5a0b6438781aefaedc250e926">fat16_close_dir</a> (struct fat16_dir_struct *dd)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Closes a directory descriptor.  <a href="#g95f491a5a0b6438781aefaedc250e926"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#g73c8f0598e8224736b09644c48cf2970">fat16_read_dir</a> (struct fat16_dir_struct *dd, struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *dir_entry)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Reads the next directory entry contained within a parent directory.  <a href="#g73c8f0598e8224736b09644c48cf2970"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#gaed63addc9b9a3d5137f3b552abb42d8">fat16_reset_dir</a> (struct fat16_dir_struct *dd)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Resets a directory handle.  <a href="#gaed63addc9b9a3d5137f3b552abb42d8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.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">&nbsp;</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&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.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">&nbsp;</td><td class="mdescRight">Deletes a file or directory.  <a href="#ge060faccbbeca802afe86be2f4d5b485"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#g973def42513263e311ffa8e21f42b287">fat16_create_dir</a> (struct fat16_dir_struct *parent, const char *dir, struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *dir_entry)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates a directory.  <a href="#g973def42513263e311ffa8e21f42b287"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.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>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the modification date of a file.  <a href="#g82c7347c5b3cd8832633d5303552eb38"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.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>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the modification time of a file.  <a href="#g5040fcab753ef55337292daf8c0d6784"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.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">&nbsp;</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">uint32_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#g8af3c3535929e19b0039e07f1976cec7">fat16_get_fs_size</a> (const struct fat16_fs_struct *fs)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the amount of total storage capacity of the filesystem in bytes.  <a href="#g8af3c3535929e19b0039e07f1976cec7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">uint32_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__fat16.html#g2f8ff07cca44ecb6770b12a58b6cd8c7">fat16_get_fs_free</a> (const struct fat16_fs_struct *fs)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the amount of free storage capacity on the filesystem in bytes.  <a href="#g2f8ff07cca44ecb6770b12a58b6cd8c7"></a><br></td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g6588833571e6ef0f5d094b8ff56a5985"></a><!-- doxytag: member="fat16.h::fat16_close" ref="g6588833571e6ef0f5d094b8ff56a5985" args="(struct fat16_fs_struct *fs)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void fat16_close           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_fs_struct *&nbsp;</td>
          <td class="paramname"> <em>fs</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Closes a FAT16 filesystem. 
<p>
When this function returns, the given filesystem descriptor will be invalid.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>fs</em>&nbsp;</td><td>The filesystem to close. </td></tr>
  </table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#gc176ec2f1bfa8c81972ea741a941e579" title="Opens a FAT16 filesystem.">fat16_open</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="g95f491a5a0b6438781aefaedc250e926"></a><!-- doxytag: member="fat16.h::fat16_close_dir" ref="g95f491a5a0b6438781aefaedc250e926" args="(struct fat16_dir_struct *dd)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void fat16_close_dir           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_dir_struct *&nbsp;</td>
          <td class="paramname"> <em>dd</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Closes a directory descriptor. 
<p>
This function destroys a directory descriptor which was previously obtained by calling <a class="el" href="group__fat16__dir.html#g9704120fef030632a76d91cfbbef78b0" title="Opens a directory.">fat16_open_dir()</a>. When this function returns, the given descriptor will be invalid.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dd</em>&nbsp;</td><td>The directory descriptor to close. </td></tr>
  </table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#g9704120fef030632a76d91cfbbef78b0" title="Opens a directory.">fat16_open_dir</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="g2b2812041f489bc7913bfa5cbcf0172b"></a><!-- doxytag: member="fat16.h::fat16_close_file" ref="g2b2812041f489bc7913bfa5cbcf0172b" args="(struct fat16_file_struct *fd)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void fat16_close_file           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_file_struct *&nbsp;</td>
          <td class="paramname"> <em>fd</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<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>&nbsp;</td><td valign="top"><em>fd</em>&nbsp;</td><td>The file handle of the file to close. </td></tr>
  </table>
</dl>
<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>

</div>
</div><p>
<a class="anchor" name="g973def42513263e311ffa8e21f42b287"></a><!-- doxytag: member="fat16.h::fat16_create_dir" ref="g973def42513263e311ffa8e21f42b287" args="(struct fat16_dir_struct *parent, const char *dir, struct fat16_dir_entry_struct *dir_entry)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t fat16_create_dir           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_dir_struct *&nbsp;</td>
          <td class="paramname"> <em>parent</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>dir</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
          <td class="paramname"> <em>dir_entry</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates a directory. 
<p>
Creates a directory and obtains its directory entry. If the directory to create already exists, its directory entry will be returned within the dir_entry parameter.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>The notes which apply to fat16_create_file also apply to this function.</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>parent</em>&nbsp;</td><td>The handle of the parent directory of the new directory. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dir</em>&nbsp;</td><td>The name of the directory to create. </td></tr>
    <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 directory. </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__fat16__dir.html#gdf22d7b37d27047d41e6d5cbf93cdff4" title="Deletes a directory.">fat16_delete_dir</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="gf8029e3ec633902d08e8204d13afc350"></a><!-- doxytag: member="fat16.h::fat16_create_file" ref="gf8029e3ec633902d08e8204d13afc350" args="(struct fat16_dir_struct *parent, const char *file, struct fat16_dir_entry_struct *dir_entry)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t fat16_create_file           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_dir_struct *&nbsp;</td>
          <td class="paramname"> <em>parent</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
          <td class="paramname"> <em>dir_entry</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<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 class="note" 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>&nbsp;</td><td valign="top"><em>parent</em>&nbsp;</td><td>The handle of the directory in which to create the file. </td></tr>
    <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>
    <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>
  </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__fat16.html#ge060faccbbeca802afe86be2f4d5b485" title="Deletes a file or directory.">fat16_delete_file</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="ge060faccbbeca802afe86be2f4d5b485"></a><!-- doxytag: member="fat16.h::fat16_delete_file" ref="ge060faccbbeca802afe86be2f4d5b485" args="(struct fat16_fs_struct *fs, struct fat16_dir_entry_struct *dir_entry)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t fat16_delete_file           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_fs_struct *&nbsp;</td>
          <td class="paramname"> <em>fs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
          <td class="paramname"> <em>dir_entry</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Deletes a file or directory. 
<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 compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <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>
    <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>
  </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__fat16.html#gf8029e3ec633902d08e8204d13afc350" title="Creates a file.">fat16_create_file</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="g0045fe378de2f7c52b528f985e1891a6"></a><!-- doxytag: member="fat16.h::fat16_get_dir_entry_of_path" ref="g0045fe378de2f7c52b528f985e1891a6" args="(struct fat16_fs_struct *fs, const char *path, struct fat16_dir_entry_struct *dir_entry)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t fat16_get_dir_entry_of_path           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_fs_struct *&nbsp;</td>
          <td class="paramname"> <em>fs</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>path</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
          <td class="paramname"> <em>dir_entry</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Retrieves the directory entry of a path. 
<p>
The given path may both describe a file or a directory.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <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>
    <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>
    <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>
  </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__fat16.html#g73c8f0598e8224736b09644c48cf2970" title="Reads the next directory entry contained within a parent directory.">fat16_read_dir</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="g82c7347c5b3cd8832633d5303552eb38"></a><!-- doxytag: member="fat16.h::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)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void fat16_get_file_modification_date           </td>
          <td>(</td>
          <td class="paramtype">const struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
          <td class="paramname"> <em>dir_entry</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t *&nbsp;</td>
          <td class="paramname"> <em>year</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&nbsp;</td>
          <td class="paramname"> <em>month</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&nbsp;</td>
          <td class="paramname"> <em>day</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the modification date of 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>&nbsp;</td><td valign="top"><em>dir_entry</em>&nbsp;</td><td>The directory entry of which to return the modification date. </td></tr>
    <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>
    <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>
    <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>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="g5040fcab753ef55337292daf8c0d6784"></a><!-- doxytag: member="fat16.h::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)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void fat16_get_file_modification_time           </td>
          <td>(</td>
          <td class="paramtype">const struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
          <td class="paramname"> <em>dir_entry</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&nbsp;</td>
          <td class="paramname"> <em>hour</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&nbsp;</td>
          <td class="paramname"> <em>min</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&nbsp;</td>
          <td class="paramname"> <em>sec</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the modification time of 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>&nbsp;</td><td valign="top"><em>dir_entry</em>&nbsp;</td><td>The directory entry of which to return the modification time. </td></tr>
    <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>
    <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>
    <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>
  </table>
</dl>

</div>
</div><p>
<a class="anchor" name="g2f8ff07cca44ecb6770b12a58b6cd8c7"></a><!-- doxytag: member="fat16.h::fat16_get_fs_free" ref="g2f8ff07cca44ecb6770b12a58b6cd8c7" args="(const struct fat16_fs_struct *fs)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t fat16_get_fs_free           </td>
          <td>(</td>
          <td class="paramtype">const struct fat16_fs_struct *&nbsp;</td>
          <td class="paramname"> <em>fs</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the amount of free storage capacity on the filesystem in bytes. 
<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>As the FAT16 filesystem is cluster based, this function does not return continuous values but multiples of the cluster size.</dd></dl>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <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>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on failure, the free filesystem space in bytes otherwise. </dd></dl>

</div>
</div><p>
<a class="anchor" name="g8af3c3535929e19b0039e07f1976cec7"></a><!-- doxytag: member="fat16.h::fat16_get_fs_size" ref="g8af3c3535929e19b0039e07f1976cec7" args="(const struct fat16_fs_struct *fs)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t fat16_get_fs_size           </td>
          <td>(</td>
          <td class="paramtype">const struct fat16_fs_struct *&nbsp;</td>
          <td class="paramname"> <em>fs</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the amount of total storage capacity of the filesystem in bytes. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <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>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on failure, the filesystem size in bytes otherwise. </dd></dl>

</div>
</div><p>
<a class="anchor" name="gc176ec2f1bfa8c81972ea741a941e579"></a><!-- doxytag: member="fat16.h::fat16_open" ref="gc176ec2f1bfa8c81972ea741a941e579" args="(struct partition_struct *partition)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct fat16_fs_struct* fat16_open           </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structpartition__struct.html">partition_struct</a> *&nbsp;</td>
          <td class="paramname"> <em>partition</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"><code> [read]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Opens a FAT16 filesystem. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>partition</em>&nbsp;</td><td>Discriptor of partition on which the filesystem resides. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>0 on error, a FAT16 filesystem descriptor on success. </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#gc176ec2f1bfa8c81972ea741a941e579" title="Opens a FAT16 filesystem.">fat16_open</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="g9704120fef030632a76d91cfbbef78b0"></a><!-- doxytag: member="fat16.h::fat16_open_dir" ref="g9704120fef030632a76d91cfbbef78b0" args="(struct fat16_fs_struct *fs, const struct fat16_dir_entry_struct *dir_entry)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct fat16_dir_struct* fat16_open_dir           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_fs_struct *&nbsp;</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="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
          <td class="paramname"> <em>dir_entry</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [read]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Opens a directory. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>fs</em>&nbsp;</td><td>The filesystem on which the directory to open resides. </td></tr>
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dir_entry</em>&nbsp;</td><td>The directory entry which stands for the directory to open. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>An opaque directory descriptor on success, 0 on failure. </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__fat16.html#g95f491a5a0b6438781aefaedc250e926" title="Closes a directory descriptor.">fat16_close_dir</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="g3a43c9943251749978645ad8e3f16757"></a><!-- doxytag: member="fat16.h::fat16_open_file" ref="g3a43c9943251749978645ad8e3f16757" args="(struct fat16_fs_struct *fs, const struct fat16_dir_entry_struct *dir_entry)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct fat16_file_struct* fat16_open_file           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_fs_struct *&nbsp;</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="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
          <td class="paramname"> <em>dir_entry</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"><code> [read]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Opens a file on a FAT16 filesystem. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <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>
    <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>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>The file handle, or 0 on failure. </dd></dl>
<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>

</div>
</div><p>
<a class="anchor" name="g73c8f0598e8224736b09644c48cf2970"></a><!-- doxytag: member="fat16.h::fat16_read_dir" ref="g73c8f0598e8224736b09644c48cf2970" args="(struct fat16_dir_struct *dd, struct fat16_dir_entry_struct *dir_entry)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t fat16_read_dir           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_dir_struct *&nbsp;</td>
          <td class="paramname"> <em>dd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structfat16__dir__entry__struct.html">fat16_dir_entry_struct</a> *&nbsp;</td>
          <td class="paramname"> <em>dir_entry</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Reads the next directory entry contained within a parent directory. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"><tt>[in]</tt>&nbsp;</td><td valign="top"><em>dd</em>&nbsp;</td><td>The descriptor of the parent directory from which to read the entry. </td></tr>
    <tr><td valign="top"><tt>[out]</tt>&nbsp;</td><td valign="top"><em>dir_entry</em>&nbsp;</td><td>Pointer to a buffer into which to write the directory entry information. </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__fat16.html#gaed63addc9b9a3d5137f3b552abb42d8" title="Resets a directory handle.">fat16_reset_dir</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="g0af2ef3d690626a5640a334cefbb27a6"></a><!-- doxytag: member="fat16.h::fat16_read_file" ref="g0af2ef3d690626a5640a334cefbb27a6" args="(struct fat16_file_struct *fd, uint8_t *buffer, uint16_t buffer_len)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int16_t fat16_read_file           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_file_struct *&nbsp;</td>
          <td class="paramname"> <em>fd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&nbsp;</td>
          <td class="paramname"> <em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>buffer_len</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></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>&nbsp;</td><td valign="top"><em>fd</em>&nbsp;</td><td>The file handle of the file from which to read. </td></tr>
    <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>
    <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>
  </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__fat16.html#g4f0c785a47b1cf070839b5edec2c6f65" title="Writes data to a file.">fat16_write_file</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="gaed63addc9b9a3d5137f3b552abb42d8"></a><!-- doxytag: member="fat16.h::fat16_reset_dir" ref="gaed63addc9b9a3d5137f3b552abb42d8" args="(struct fat16_dir_struct *dd)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t fat16_reset_dir           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_dir_struct *&nbsp;</td>
          <td class="paramname"> <em>dd</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></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>&nbsp;</td><td valign="top"><em>dd</em>&nbsp;</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__fat16.html#g73c8f0598e8224736b09644c48cf2970" title="Reads the next directory entry contained within a parent directory.">fat16_read_dir</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="g23740742fa60ca148ef098caac7085c0"></a><!-- doxytag: member="fat16.h::fat16_resize_file" ref="g23740742fa60ca148ef098caac7085c0" args="(struct fat16_file_struct *fd, uint32_t size)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t fat16_resize_file           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_file_struct *&nbsp;</td>
          <td class="paramname"> <em>fd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&nbsp;</td>
          <td class="paramname"> <em>size</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></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>&nbsp;</td><td valign="top"><em>fd</em>&nbsp;</td><td>The file decriptor of the file which to resize. </td></tr>
    <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>
  </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="gf1511fd1a5419d0828265566dc5d33e4"></a><!-- doxytag: member="fat16.h::fat16_seek_file" ref="gf1511fd1a5419d0828265566dc5d33e4" args="(struct fat16_file_struct *fd, int32_t *offset, uint8_t whence)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t fat16_seek_file           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_file_struct *&nbsp;</td>
          <td class="paramname"> <em>fd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t *&nbsp;</td>
          <td class="paramname"> <em>offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&nbsp;</td>
          <td class="paramname"> <em>whence</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></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__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>
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>
The new offset can be given in different ways determined by the <code>whence</code> parameter:<ul>
<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>
<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>&nbsp;</td><td valign="top"><em>fd</em>&nbsp;</td><td>The file decriptor of the file on which to seek. </td></tr>
    <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>
    <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>
  </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="g4f0c785a47b1cf070839b5edec2c6f65"></a><!-- doxytag: member="fat16.h::fat16_write_file" ref="g4f0c785a47b1cf070839b5edec2c6f65" args="(struct fat16_file_struct *fd, const uint8_t *buffer, uint16_t buffer_len)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int16_t fat16_write_file           </td>
          <td>(</td>
          <td class="paramtype">struct fat16_file_struct *&nbsp;</td>
          <td class="paramname"> <em>fd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&nbsp;</td>
          <td class="paramname"> <em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>buffer_len</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></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>&nbsp;</td><td valign="top"><em>fd</em>&nbsp;</td><td>The file handle of the file to which to write. </td></tr>
    <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>
    <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>
  </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__fat16.html#g0af2ef3d690626a5640a334cefbb27a6" title="Reads data from a file.">fat16_read_file</a> </dd></dl>

</div>
</div><p>
<hr size="1"><address style="text-align: right;"><small>Generated on Thu Dec 13 19:38:48 2007 for sd-reader by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3-20071008 </small></address>
</body>
</html>