<!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"/>
<title>libGIS: ihex.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<h1>ihex.h File Reference</h1>  </div>
</div>
<div class="contents">

<p>Low-level utility functions to create, read, write, and print Intel HEX8 binary records.  
<a href="#_details">More...</a></p>
<code>#include &lt;stdio.h&gt;</code><br/>
<code>#include &lt;stdint.h&gt;</code><br/>
<code>#include &lt;stdlib.h&gt;</code><br/>
<code>#include &lt;string.h&gt;</code><br/>

<p><a href="ihex_8h_source.html">Go to the source code of this file.</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 &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="structIHexRecord.html">IHexRecord</a></td></tr>
<tr><td colspan="2"><h2><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><b>_IHexDefinitions</b> { <br/>
&nbsp;&nbsp;<b>IHEX_RECORD_BUFF_SIZE</b> =  768, 
<b>IHEX_COUNT_OFFSET</b> =  1, 
<b>IHEX_COUNT_LEN</b> =  2, 
<b>IHEX_ADDRESS_OFFSET</b> =  3, 
<br/>
&nbsp;&nbsp;<b>IHEX_ADDRESS_LEN</b> =  4, 
<b>IHEX_TYPE_OFFSET</b> =  7, 
<b>IHEX_TYPE_LEN</b> =  2, 
<b>IHEX_DATA_OFFSET</b> =  9, 
<br/>
&nbsp;&nbsp;<b>IHEX_CHECKSUM_LEN</b> =  2, 
<b>IHEX_MAX_DATA_LEN</b> =  512, 
<b>IHEX_ASCII_HEX_BYTE_LEN</b> =  2, 
<b>IHEX_START_CODE_OFFSET</b> =  0, 
<br/>
&nbsp;&nbsp;<b>IHEX_START_CODE</b> =  ':'
<br/>
 }</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ihex_8h.html#a50713c91e9dbe1b81a5937fdcb4e97b9">IHexErrors</a> { <br/>
&nbsp;&nbsp;<a class="el" href="ihex_8h.html#a50713c91e9dbe1b81a5937fdcb4e97b9a0902cd4e9ca06092edd4e34b5214018c">IHEX_OK</a> =  0, 
<a class="el" href="ihex_8h.html#a50713c91e9dbe1b81a5937fdcb4e97b9a304bd934308a608286b648e6b60322f1">IHEX_ERROR_FILE</a> =  -1, 
<a class="el" href="ihex_8h.html#a50713c91e9dbe1b81a5937fdcb4e97b9ae8d40563a3fe5e25969c24fc4ddba4e0">IHEX_ERROR_EOF</a> =  -2, 
<a class="el" href="ihex_8h.html#a50713c91e9dbe1b81a5937fdcb4e97b9a69735171750f18c10570f136e2860ca8">IHEX_ERROR_INVALID_RECORD</a> =  -3, 
<br/>
&nbsp;&nbsp;<a class="el" href="ihex_8h.html#a50713c91e9dbe1b81a5937fdcb4e97b9a3ee89be592ae9596f3cf3610143fc09e">IHEX_ERROR_INVALID_ARGUMENTS</a> =  -4, 
<a class="el" href="ihex_8h.html#a50713c91e9dbe1b81a5937fdcb4e97b9aa62b5a20b6c24eb9238b4ac51b649135">IHEX_ERROR_NEWLINE</a> =  -5
<br/>
 }</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ihex_8h.html#aae90176fd53987bc2299e53d78ba7137">IHexRecordTypes</a> { <br/>
&nbsp;&nbsp;<a class="el" href="ihex_8h.html#aae90176fd53987bc2299e53d78ba7137a528c4e2bf017d5ee4eddfeebd54f0831">IHEX_TYPE_00</a> =  0, 
<a class="el" href="ihex_8h.html#aae90176fd53987bc2299e53d78ba7137af02c34a935cae30f9506612ee62f2e07">IHEX_TYPE_01</a>, 
<a class="el" href="ihex_8h.html#aae90176fd53987bc2299e53d78ba7137a8565df803b777b0da5e9a94464091ec6">IHEX_TYPE_02</a>, 
<a class="el" href="ihex_8h.html#aae90176fd53987bc2299e53d78ba7137a89a825325da04f361baa11fe7e3d4ba9">IHEX_TYPE_03</a>, 
<br/>
&nbsp;&nbsp;<a class="el" href="ihex_8h.html#aae90176fd53987bc2299e53d78ba7137a864539d4c6cac1d752a6ac2806f32f54">IHEX_TYPE_04</a>, 
<a class="el" href="ihex_8h.html#aae90176fd53987bc2299e53d78ba7137ae490d0a7dab6a2a4c5322b977e872f41">IHEX_TYPE_05</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">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ihex_8h.html#a306f183ff3561d1006462a7e25cee163">New_IHexRecord</a> (int type, uint16_t address, const uint8_t *data, int dataLen, <a class="el" href="structIHexRecord.html">IHexRecord</a> *ihexRecord)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ihex_8h.html#a30b9b5a4a7c7fa3e5f57b0573482b0bc">Read_IHexRecord</a> (<a class="el" href="structIHexRecord.html">IHexRecord</a> *ihexRecord, FILE *in)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ihex_8h.html#a7ad50e2969817d44a38c7e3619a3053d">Write_IHexRecord</a> (const <a class="el" href="structIHexRecord.html">IHexRecord</a> *ihexRecord, FILE *out)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ihex_8h.html#a7777885754eb18766d34abb57cd4782e">Print_IHexRecord</a> (const <a class="el" href="structIHexRecord.html">IHexRecord</a> *ihexRecord)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ihex_8h.html#ad261f014a85366ec397305a160adaa64">Checksum_IHexRecord</a> (const <a class="el" href="structIHexRecord.html">IHexRecord</a> *ihexRecord)</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Low-level utility functions to create, read, write, and print Intel HEX8 binary records. </p>
<dl class="author"><dt><b>Author:</b></dt><dd>Vanya A. Sergeev &lt;<a href="mailto:vsergeev@gmail.com">vsergeev@gmail.com</a>&gt; </dd></dl>
<dl class="date"><dt><b>Date:</b></dt><dd>February 2011 </dd></dl>
<dl class="version"><dt><b>Version:</b></dt><dd>1.0.5 </dd></dl>
<hr/><h2>Enumeration Type Documentation</h2>
<a class="anchor" id="a50713c91e9dbe1b81a5937fdcb4e97b9"></a><!-- doxytag: member="ihex.h::IHexErrors" ref="a50713c91e9dbe1b81a5937fdcb4e97b9" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="ihex_8h.html#a50713c91e9dbe1b81a5937fdcb4e97b9">IHexErrors</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>All possible error codes the Intel HEX8 record utility functions may return. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="a50713c91e9dbe1b81a5937fdcb4e97b9a0902cd4e9ca06092edd4e34b5214018c"></a><!-- doxytag: member="IHEX_OK" ref="a50713c91e9dbe1b81a5937fdcb4e97b9a0902cd4e9ca06092edd4e34b5214018c" args="" -->IHEX_OK</em>&nbsp;</td><td>
<p>Error code for success or no error. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a50713c91e9dbe1b81a5937fdcb4e97b9a304bd934308a608286b648e6b60322f1"></a><!-- doxytag: member="IHEX_ERROR_FILE" ref="a50713c91e9dbe1b81a5937fdcb4e97b9a304bd934308a608286b648e6b60322f1" args="" -->IHEX_ERROR_FILE</em>&nbsp;</td><td>
<p>Error code for error while reading from or writing to a file. You may check errno for the exact error if this error code is encountered. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a50713c91e9dbe1b81a5937fdcb4e97b9ae8d40563a3fe5e25969c24fc4ddba4e0"></a><!-- doxytag: member="IHEX_ERROR_EOF" ref="a50713c91e9dbe1b81a5937fdcb4e97b9ae8d40563a3fe5e25969c24fc4ddba4e0" args="" -->IHEX_ERROR_EOF</em>&nbsp;</td><td>
<p>Error code for encountering end-of-file when reading from a file. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a50713c91e9dbe1b81a5937fdcb4e97b9a69735171750f18c10570f136e2860ca8"></a><!-- doxytag: member="IHEX_ERROR_INVALID_RECORD" ref="a50713c91e9dbe1b81a5937fdcb4e97b9a69735171750f18c10570f136e2860ca8" args="" -->IHEX_ERROR_INVALID_RECORD</em>&nbsp;</td><td>
<p>Error code for error if an invalid record was read. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a50713c91e9dbe1b81a5937fdcb4e97b9a3ee89be592ae9596f3cf3610143fc09e"></a><!-- doxytag: member="IHEX_ERROR_INVALID_ARGUMENTS" ref="a50713c91e9dbe1b81a5937fdcb4e97b9a3ee89be592ae9596f3cf3610143fc09e" args="" -->IHEX_ERROR_INVALID_ARGUMENTS</em>&nbsp;</td><td>
<p>Error code for error from invalid arguments passed to function. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a50713c91e9dbe1b81a5937fdcb4e97b9aa62b5a20b6c24eb9238b4ac51b649135"></a><!-- doxytag: member="IHEX_ERROR_NEWLINE" ref="a50713c91e9dbe1b81a5937fdcb4e97b9aa62b5a20b6c24eb9238b4ac51b649135" args="" -->IHEX_ERROR_NEWLINE</em>&nbsp;</td><td>
<p>Error code for encountering a newline with no record when reading from a file. </p>
</td></tr>
</table>
</dd>
</dl>

</div>
</div>
<a class="anchor" id="aae90176fd53987bc2299e53d78ba7137"></a><!-- doxytag: member="ihex.h::IHexRecordTypes" ref="aae90176fd53987bc2299e53d78ba7137" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="ihex_8h.html#aae90176fd53987bc2299e53d78ba7137">IHexRecordTypes</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Intel HEX8 Record Types 00-05 </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="aae90176fd53987bc2299e53d78ba7137a528c4e2bf017d5ee4eddfeebd54f0831"></a><!-- doxytag: member="IHEX_TYPE_00" ref="aae90176fd53987bc2299e53d78ba7137a528c4e2bf017d5ee4eddfeebd54f0831" args="" -->IHEX_TYPE_00</em>&nbsp;</td><td>
<p>Data Record </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="aae90176fd53987bc2299e53d78ba7137af02c34a935cae30f9506612ee62f2e07"></a><!-- doxytag: member="IHEX_TYPE_01" ref="aae90176fd53987bc2299e53d78ba7137af02c34a935cae30f9506612ee62f2e07" args="" -->IHEX_TYPE_01</em>&nbsp;</td><td>
<p>End of File Record </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="aae90176fd53987bc2299e53d78ba7137a8565df803b777b0da5e9a94464091ec6"></a><!-- doxytag: member="IHEX_TYPE_02" ref="aae90176fd53987bc2299e53d78ba7137a8565df803b777b0da5e9a94464091ec6" args="" -->IHEX_TYPE_02</em>&nbsp;</td><td>
<p>Extended Segment Address Record </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="aae90176fd53987bc2299e53d78ba7137a89a825325da04f361baa11fe7e3d4ba9"></a><!-- doxytag: member="IHEX_TYPE_03" ref="aae90176fd53987bc2299e53d78ba7137a89a825325da04f361baa11fe7e3d4ba9" args="" -->IHEX_TYPE_03</em>&nbsp;</td><td>
<p>Start Segment Address Record </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="aae90176fd53987bc2299e53d78ba7137a864539d4c6cac1d752a6ac2806f32f54"></a><!-- doxytag: member="IHEX_TYPE_04" ref="aae90176fd53987bc2299e53d78ba7137a864539d4c6cac1d752a6ac2806f32f54" args="" -->IHEX_TYPE_04</em>&nbsp;</td><td>
<p>Extended Linear Address Record </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="aae90176fd53987bc2299e53d78ba7137ae490d0a7dab6a2a4c5322b977e872f41"></a><!-- doxytag: member="IHEX_TYPE_05" ref="aae90176fd53987bc2299e53d78ba7137ae490d0a7dab6a2a4c5322b977e872f41" args="" -->IHEX_TYPE_05</em>&nbsp;</td><td>
<p>Start Linear Address Record </p>
</td></tr>
</table>
</dd>
</dl>

</div>
</div>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ad261f014a85366ec397305a160adaa64"></a><!-- doxytag: member="ihex.h::Checksum_IHexRecord" ref="ad261f014a85366ec397305a160adaa64" args="(const IHexRecord *ihexRecord)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t Checksum_IHexRecord </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structIHexRecord.html">IHexRecord</a> *&nbsp;</td>
          <td class="paramname"> <em>ihexRecord</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Calculates the checksum of an Intel HEX8 <a class="el" href="structIHexRecord.html">IHexRecord</a> structure. See the Intel HEX8 specifications for more details on the checksum calculation. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ihexRecord</em>&nbsp;</td><td>A pointer to the Intel HEX8 record structure. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The 8-bit checksum. </dd></dl>

</div>
</div>
<a class="anchor" id="a306f183ff3561d1006462a7e25cee163"></a><!-- doxytag: member="ihex.h::New_IHexRecord" ref="a306f183ff3561d1006462a7e25cee163" args="(int type, uint16_t address, const uint8_t *data, int dataLen, IHexRecord *ihexRecord)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int New_IHexRecord </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>address</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&nbsp;</td>
          <td class="paramname"> <em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>dataLen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structIHexRecord.html">IHexRecord</a> *&nbsp;</td>
          <td class="paramname"> <em>ihexRecord</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Sets all of the record fields of an Intel HEX8 record structure. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>type</em>&nbsp;</td><td>The Intel HEX8 record type (integer value of 0 through 5). </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>address</em>&nbsp;</td><td>The 16-bit address of the data. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>A point to the 8-bit array of data. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>dataLen</em>&nbsp;</td><td>The size of the 8-bit data array. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>ihexRecord</em>&nbsp;</td><td>A pointer to the target Intel HEX8 record structure where these fields will be set. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>IHEX_OK on success, otherwise one of the IHEX_ERROR_ error codes. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>IHEX_OK</em>&nbsp;</td><td>on success. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>IHEX_ERROR_INVALID_ARGUMENTS</em>&nbsp;</td><td>if the record pointer is NULL, or if the length of the 8-bit data array is out of range (less than zero or greater than the maximum data length allowed by record specifications, see <a class="el" href="structIHexRecord.html#a3e72d4f4019cf13ee78bd7e8bbf3ec8a">IHexRecord.data</a>). </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a7777885754eb18766d34abb57cd4782e"></a><!-- doxytag: member="ihex.h::Print_IHexRecord" ref="a7777885754eb18766d34abb57cd4782e" args="(const IHexRecord *ihexRecord)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Print_IHexRecord </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structIHexRecord.html">IHexRecord</a> *&nbsp;</td>
          <td class="paramname"> <em>ihexRecord</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Prints the contents of an Intel HEX8 record structure to stdout. The record dump consists of the type, address, entire data array, and checksum fields of the record. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ihexRecord</em>&nbsp;</td><td>A pointer to the Intel HEX8 record structure. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Always returns IHEX_OK (success). </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>IHEX_OK</em>&nbsp;</td><td>on success. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a30b9b5a4a7c7fa3e5f57b0573482b0bc"></a><!-- doxytag: member="ihex.h::Read_IHexRecord" ref="a30b9b5a4a7c7fa3e5f57b0573482b0bc" args="(IHexRecord *ihexRecord, FILE *in)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Read_IHexRecord </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structIHexRecord.html">IHexRecord</a> *&nbsp;</td>
          <td class="paramname"> <em>ihexRecord</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&nbsp;</td>
          <td class="paramname"> <em>in</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Reads an Intel HEX8 record from an opened file. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ihexRecord</em>&nbsp;</td><td>A pointer to the Intel HEX8 record structure that will store the read record. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>in</em>&nbsp;</td><td>A file pointer to an opened file that can be read. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>IHEX_OK on success, otherwise one of the IHEX_ERROR_ error codes. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>IHEX_OK</em>&nbsp;</td><td>on success. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>IHEX_ERROR_INVALID_ARGUMENTS</em>&nbsp;</td><td>if the record pointer or file pointer is NULL. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>IHEX_ERROR_EOF</em>&nbsp;</td><td>if end-of-file has been reached. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>IHEX_ERROR_FILE</em>&nbsp;</td><td>if a file reading error has occured. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>IHEX_INVALID_RECORD</em>&nbsp;</td><td>if the record read is invalid (record did not match specifications or record checksum was invalid). </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a7ad50e2969817d44a38c7e3619a3053d"></a><!-- doxytag: member="ihex.h::Write_IHexRecord" ref="a7ad50e2969817d44a38c7e3619a3053d" args="(const IHexRecord *ihexRecord, FILE *out)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Write_IHexRecord </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structIHexRecord.html">IHexRecord</a> *&nbsp;</td>
          <td class="paramname"> <em>ihexRecord</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&nbsp;</td>
          <td class="paramname"> <em>out</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Writes an Intel HEX8 record to an opened file. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>ihexRecord</em>&nbsp;</td><td>A pointer to the Intel HEX8 record structure. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>out</em>&nbsp;</td><td>A file pointer to an opened file that can be written to. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>IHEX_OK on success, otherwise one of the IHEX_ERROR_ error codes. </dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>IHEX_OK</em>&nbsp;</td><td>on success. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>IHEX_ERROR_INVALID_ARGUMENTS</em>&nbsp;</td><td>if the record pointer or file pointer is NULL. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>IHEX_ERROR_INVALID_RECORD</em>&nbsp;</td><td>if the record's data length is out of range (greater than the maximum data length allowed by record specifications, see <a class="el" href="structIHexRecord.html#a3e72d4f4019cf13ee78bd7e8bbf3ec8a">IHexRecord.data</a>). </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>IHEX_ERROR_FILE</em>&nbsp;</td><td>if a file writing error has occured. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Sat Feb 5 2011 19:38:39 for libGIS by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>
