<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>My Piece of the Inter(.)net &#187; C#</title>
	<atom:link href="http://mypieceoftheinter.net/tag/c/feed" rel="self" type="application/rss+xml" />
	<link>http://mypieceoftheinter.net</link>
	<description>A place for my geekish ramblings or whatever I find interesting.</description>
	<lastBuildDate>Mon, 16 Jan 2012 16:35:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
		<item>
		<title>C++ How-To: Print a Buffer</title>
		<link>http://mypieceoftheinter.net/archives/1749</link>
		<comments>http://mypieceoftheinter.net/archives/1749#comments</comments>
		<pubDate>Sun, 02 Aug 2009 00:12:10 +0000</pubDate>
		<dc:creator>David McGrath</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[g++]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Visual C++]]></category>

		<guid isPermaLink="false">http://mypieceoftheinter.net/archives/1749</guid>
		<description><![CDATA[I was recently writing a command line application in C++ that parses raw binary.&#160; I thought it would be really nice to be able to print different parts of memory to the screen as the program runs.&#160; I’ve included well-commented code and a usage example. 1: //needed for printf() 2: #include &#60;stdio.h&#62; 3:&#160; 4: //needed [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently writing a command line application in C++ that parses raw binary.&#160; I thought it would be really nice to be able to print different parts of memory to the screen as the program runs.&#160; I’ve included well-commented code and a usage example.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; max-height: 300px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #008000">//needed for printf()</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #cc6633">#include</span> &lt;stdio.h&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #008000">//needed for strlen()</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #cc6633">#include</span> &lt;string.h&gt;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> <span style="color: #008000">// prints the contents of memory in hex and ascii.</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> <span style="color: #008000">// starts at the location of the pointer &quot;start&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #008000">// prints &quot;length&quot; bytes of memory.</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> <span style="color: #0000ff">void</span> Print_Memory(<span style="color: #0000ff">const</span> <span style="color: #0000ff">unsigned</span> <span style="color: #0000ff">char</span> * start, <span style="color: #0000ff">unsigned</span> <span style="color: #0000ff">int</span> length)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>     <span style="color: #008000">//create row, col, and i.  Set i to 0</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>     <span style="color: #0000ff">int</span> row, col, i = 0;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     <span style="color: #008000">//iterate through the rows, which will be 16 bytes of memory wide</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     <span style="color: #0000ff">for</span>(row = 0; (i + 1) &lt; length; row++)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum18">  18:</span>         <span style="color: #008000">//print hex representation</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum19">  19:</span>         <span style="color: #0000ff">for</span>(col = 0; col&lt;16; col++)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum20">  20:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum21">  21:</span>             <span style="color: #008000">//calculate the current index</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum22">  22:</span>             i = row*16+col;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum23">  23:</span>             </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum24">  24:</span>             <span style="color: #008000">//divides a row of 16 into two columns of 8</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum25">  25:</span>             <span style="color: #0000ff">if</span>(col==8)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum26">  26:</span>                 printf(<span style="color: #006080">&quot; &quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum27">  27:</span>             </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum28">  28:</span>             <span style="color: #008000">//print the hex value if the current index is in range.</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum29">  29:</span>             <span style="color: #0000ff">if</span>(i&lt;length)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum30">  30:</span>                 printf(<span style="color: #006080">&quot;%02X&quot;</span>, start[i]);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum31">  31:</span>             <span style="color: #008000">//print a blank if the current index is past the end</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum32">  32:</span>             <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum33">  33:</span>                 printf(<span style="color: #006080">&quot;  &quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum34">  34:</span>             </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum35">  35:</span>             <span style="color: #008000">//print a space to keep the values separate</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum36">  36:</span>             printf(<span style="color: #006080">&quot; &quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum37">  37:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum38">  38:</span>         </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum39">  39:</span>         <span style="color: #008000">//create a vertial seperator between hex and ascii representations</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum40">  40:</span>         printf(<span style="color: #006080">&quot; &quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum41">  41:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum42">  42:</span>         <span style="color: #008000">//print ascii representation</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum43">  43:</span>         <span style="color: #0000ff">for</span>(col = 0; col&lt;16; col++)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum44">  44:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum45">  45:</span>             <span style="color: #008000">//calculate the current index</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum46">  46:</span>             i = row*16+col;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum47">  47:</span>             </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum48">  48:</span>             <span style="color: #008000">//divides a row of 16 into two coumns of 8</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum49">  49:</span>             <span style="color: #0000ff">if</span>(col==8)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum50">  50:</span>                 printf(<span style="color: #006080">&quot;  &quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum51">  51:</span>             </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum52">  52:</span>             <span style="color: #008000">//print the value if it is in range</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum53">  53:</span>             <span style="color: #0000ff">if</span>(i&lt;length)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum54">  54:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum55">  55:</span>                 <span style="color: #008000">//print the ascii value if applicable</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum56">  56:</span>                 <span style="color: #0000ff">if</span>(start[i]&gt;0x20 &amp;&amp; start[i]&lt;0x7F)  <span style="color: #008000">//A-Z</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum57">  57:</span>                     printf(<span style="color: #006080">&quot;%c&quot;</span>, start[i]);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum58">  58:</span>                 <span style="color: #008000">//print a period if the value is not printable</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum59">  59:</span>                 <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum60">  60:</span>                     printf(<span style="color: #006080">&quot;.&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum61">  61:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum62">  62:</span>             <span style="color: #008000">//nothing else to print, so break out of this for loop</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum63">  63:</span>             <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum64">  64:</span>                 <span style="color: #0000ff">break</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum65">  65:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum66">  66:</span>         </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum67">  67:</span>         <span style="color: #008000">//create a new row</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum68">  68:</span>         printf(<span style="color: #006080">&quot;\n&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum69">  69:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum70">  70:</span> }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum71">  71:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum72">  72:</span> <span style="color: #008000">// Prints the contents of memory in hex and ascii.</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum73">  73:</span> <span style="color: #008000">// Prints the memory between and including the</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum74">  74:</span> <span style="color: #008000">// two &quot;end1&quot; and &quot;end2&quot; pointers.</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum75">  75:</span> <span style="color: #0000ff">void</span> Print_Memory(<span style="color: #0000ff">const</span> <span style="color: #0000ff">unsigned</span> <span style="color: #0000ff">char</span> * end1, <span style="color: #0000ff">const</span> <span style="color: #0000ff">unsigned</span> <span style="color: #0000ff">char</span> * end2)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum76">  76:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum77">  77:</span>     <span style="color: #0000ff">if</span>(end2 &gt;= end1)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum78">  78:</span>         Print_Memory(end1, end2 - end1 + 1);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum79">  79:</span>     <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum80">  80:</span>         Print_Memory(end2, end1 - end2 + 1);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum81">  81:</span> }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum82">  82:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum83">  83:</span> <span style="color: #0000ff">int</span> main(<span style="color: #0000ff">int</span> argc, <span style="color: #0000ff">char</span> **args)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum84">  84:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum85">  85:</span>     <span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span> start [] = <span style="color: #006080">&quot;hi there!  You're looking at me in memory!&quot;</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum86">  86:</span>     <span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span> * end = start + (<span style="color: #0000ff">int</span>)strlen(start);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum87">  87:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum88">  88:</span>     Print_Memory((<span style="color: #0000ff">unsigned</span> <span style="color: #0000ff">char</span> *)start, (<span style="color: #0000ff">unsigned</span> <span style="color: #0000ff">char</span> *)end);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum89">  89:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum90">  90:</span>     <span style="color: #0000ff">return</span> 0;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &quot;Courier New&quot;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum91">  91:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p><span id="more-1749"></span></p>
<p><em>I’ve compiled this code with both </em><a href="http://en.wikipedia.org/wiki/G%2B%2B"><em>g++</em></a><em> and </em><a href="http://en.wikipedia.org/wiki/Visual_C%2B%2B"><em>Visual C++.</em></a></p>
<p><a href="http://download.somewhatgeeky.com/?token=print_memory.cpp">download here</a></p>
<p>Here is the program’s output:</p>
<p>
<pre><code>68 69 20 74 68 65 72 65  21 20 20 59 6F 75 27 72  hi.there  !..You'r
65 20 6C 6F 6F 6B 69 6E  67 20 61 74 20 6D 65 20  e.lookin  g.at.me.
69 6E 20 6D 65 6D 6F 72  79 21 00                 in.memor  y!.</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://mypieceoftheinter.net/archives/1749/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Code is Poetry</title>
		<link>http://mypieceoftheinter.net/archives/1661</link>
		<comments>http://mypieceoftheinter.net/archives/1661#comments</comments>
		<pubDate>Fri, 19 Jun 2009 02:01:59 +0000</pubDate>
		<dc:creator>David McGrath</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Code is Poetry]]></category>
		<category><![CDATA[Eye-Fi]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[Human-Computer Interaction]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Thoughts]]></category>

		<guid isPermaLink="false">http://mypieceoftheinter.net/archives/1661</guid>
		<description><![CDATA[I recently ordered a new mug from zazzle.com.  “Code is poetry,” it says on one side, with my favorite programming language, C♯, on the other.  Code really is poetry, and now let me relate a memory that I thought of on my drive home from work today.  (Sorry in advance.  This post doesn’t have very [...]]]></description>
			<content:encoded><![CDATA[<p>I recently ordered a new mug from <a href="http://www.zazzle.com/">zazzle.com</a>.  “<a href="http://wordpress.org/">Code is poetry</a>,” it says on one side, with my favorite programming language, <a href="http://en.wikipedia.org/wiki/C_Sharp_(programming_language)">C♯</a>, on the other.  Code really is poetry, and now let me relate a memory that I thought of on my drive home from work today.  (Sorry in advance.  This post doesn’t have very much focus.)<br />
<a href="http://mypieceoftheinter.net/wp-content/uploads/2009/06/code-is-poetry-mug.jpg"><img style="display: inline" title="code_is_poetry_mug" src="http://mypieceoftheinter.net/wp-content/uploads/2009/06/code-is-poetry-mug-thumb.jpg" alt="code_is_poetry_mug" width="240" height="180" /></a> <a href="http://mypieceoftheinter.net/wp-content/uploads/2009/06/c-mug.jpg"><img style="display: inline" title="C#_mug" src="http://mypieceoftheinter.net/wp-content/uploads/2009/06/c-mug-thumb.jpg" alt="C#_mug" width="240" height="180" /></a></p>
<p><span id="more-1661"></span></p>
<p>When I was little, I was fascinated by what I now know are the break lights that are in the rear window of most cars.  When it was nighttime and we came to a stoplight, I noticed how even though I couldn’t see that the stoplight itself was red, there was a correlation between the stoplight being red and the red light in the rear window of the car in front of us.  I wondered by what mechanism the car in front of us knew that the light was red, and thought that it was very useful for cars to relay that information to the cars behind them.</p>
<p>I know now that the key element in making that happen was the driver tapping on the breaks, and in fact the light didn’t signify anything directly about any stop light, just that the driver had his foot on the break pedal.  Even so, I have always been interested in what makes technology tick, and (even more) how to design something that has some kind of interactivity or pseudo intelligence.  To me, code is a form of magic—now hear me out!</p>
<p>When I write a program, I pull the words out of nowhere.  I can take an idea, describe how a program should behave, and it will simply happen.  I said that this was like magic, but now let me step back a bit.  To me code lets me perform a kind of magic that applies to the virtual world rather than the physical, with a bit of crossover via different kinds of <a href="http://en.wikipedia.org/wiki/Human%E2%80%93computer_interaction">human-computer interaction</a>.  The kind of magic that code can accomplish applies to <em>information</em> rather than physical objects.  For example, the idea of someone seeing something and capturing that moment to be displayed on a picture frame in his grandparents’ house is whimsical at least—without any explanation anyway.  However, with a digital camera, an <a href="http://en.wikipedia.org/wiki/Eyefi">Eye-Fi</a> wireless SD card, and an appropriate digital picture frame, one could take a picture, the Eye-Fi could find an open wifi hotspot, connect to <a href="http://flickr.com">Flickr</a>, and upload the picture for the digital picture frame to download and display.</p>
<p>Did you just yawn there?  Most people would, but that’s kind of the point.  Technology can accomplish amazing things—the sky is <em>hardly</em> the limit.  When dreaming up an idea, it isn’t always important to have it seem realistic at first.  Furthermore, <a href="http://en.wikipedia.org/wiki/Project_Natal">no matter how cool the demo</a>, the actual magic will come down to bits and bytes… but that’s great!  To me, in creating software, the biggest barriers are knowledge, skill, and time.  With those three things one person could create a software product that works better than a similar product by a big company.  Two identical pieces of hardware could be made vastly different with different software.  Firmware updates for portable devices are a good example of this, as are videos games for any given console.  On a console, every development team has the same canvas to work with, and it is amazing to see the wildly varied experiences that different games can create.</p>
<p>I’ve always been facinated by this stuff, and always will be.  That’s great for me, though, because it’s an inexpensive hobby and a well-paying profession.  Ah, I think I’ll write a bit of code right now. <img src='http://mypieceoftheinter.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://mypieceoftheinter.net/archives/1661/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RoomieScript demo</title>
		<link>http://mypieceoftheinter.net/archives/1578</link>
		<comments>http://mypieceoftheinter.net/archives/1578#comments</comments>
		<pubDate>Wed, 15 Apr 2009 17:02:33 +0000</pubDate>
		<dc:creator>David McGrath</dc:creator>
				<category><![CDATA[Demos]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[ControlThink]]></category>
		<category><![CDATA[Roomie!]]></category>
		<category><![CDATA[RoomieScript]]></category>
		<category><![CDATA[SDK]]></category>
		<category><![CDATA[X10]]></category>
		<category><![CDATA[Z-Wave]]></category>

		<guid isPermaLink="false">http://mypieceoftheinter.net/archives/1578</guid>
		<description><![CDATA[I gave a presentation for my ENGE 1104 (Exploration of a Digital Future) class about home automation.&#160; My team members talked about X10, Z-Wave, ControlThink’s SDK, and some project ideas.&#160; I gave a brief overview of a project that I have been working on sporadically for a couple years, Roomie.&#160; In doing so, I for [...]]]></description>
			<content:encoded><![CDATA[<p>I gave a presentation for my ENGE 1104 (Exploration of a Digital Future) class about home automation.&#160; My team members talked about <a href="http://en.wikipedia.org/wiki/X10_(industry_standard)">X10</a>, <a href="http://en.wikipedia.org/wiki/Z-wave">Z-Wave</a>, <a href="http://controlthink.com/zwavesdk.htm">ControlThink’s SDK</a>, and some project ideas.&#160; I gave a brief overview of a project that I have been working on sporadically for a couple years, <a href="http://redirect.somewhatgeeky.com/?token=roomie">Roomie</a>.&#160; In doing so, I for created some documentation, so I figured I’d publish some of it here.&#160; Here is an example of RoomieScript and it’s execution:   <br /><img style="display: inline" title="RoomieScript sample" alt="RoomieScript sample" src="http://mypieceoftheinter.net/wp-content/uploads/2009/04/roomiescript-sample1.png" width="640" height="640" /></p>
]]></content:encoded>
			<wfw:commentRss>http://mypieceoftheinter.net/archives/1578/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FRI Version 1.5.0.0 Source Code</title>
		<link>http://mypieceoftheinter.net/archives/503</link>
		<comments>http://mypieceoftheinter.net/archives/503#comments</comments>
		<pubDate>Mon, 09 Jun 2008 23:01:00 +0000</pubDate>
		<dc:creator>David McGrath</dc:creator>
				<category><![CDATA[FRI]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Emulation]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Source Code]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://mypieceoftheinter.net/archives/503</guid>
		<description><![CDATA[I have a friend who is an open-source fiend, and so he nag nag nagged me to make the source code&#160; for FRI available for download.&#160; After a lot of re-organizing and commenting, here it is!&#160; The &#34;Frie&#34; project in the Visual Studio solution is the FRI back-end, stands for &#34;Fantastic ROM Indexer Engine&#34;.&#160; Yes, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mypieceoftheinter.net/wp-content/uploads/2008/06/image3.png"><img height="430" alt="Visual C# Express" src="http://mypieceoftheinter.net/wp-content/uploads/2008/06/image-thumb.png" width="640" /></a></p>
<p>I have a friend who is an open-source <em>fiend</em>, and so he nag <em>nag</em> <strong><em>nagged</em></strong> me to make the source code&#160; for FRI available for download.&#160; After a lot of re-organizing and commenting, here it is!&#160; The &quot;Frie&quot; project in the Visual Studio solution is the FRI back-end, stands for &quot;Fantastic ROM Indexer Engine&quot;.&#160; Yes, it is pronounced &quot;free&quot; just like the front-end. <img src='http://mypieceoftheinter.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I&#8217;m putting this code out on the Internet, but please keep in mind that FRI is still my baby.&#160; If you want to make a derivative work, email me first for permission.</p>
<p><a href="http://download.somewhatgeeky.com?downloadID=fri_version_1.5.0.0_source_code">Download FRI Version 1.5.0.0 Source Code here</a>    <br /><a href="http://creativecommons.org/licenses/by-nc-nd/3.0/us/" rel="license"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" alt="Creative Commons License" src="http://i.creativecommons.org/l/by-nc-nd/3.0/us/88x31.png" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://mypieceoftheinter.net/archives/503/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FRI Version 1.4.0.0</title>
		<link>http://mypieceoftheinter.net/archives/470</link>
		<comments>http://mypieceoftheinter.net/archives/470#comments</comments>
		<pubDate>Tue, 22 Apr 2008 22:15:33 +0000</pubDate>
		<dc:creator>David McGrath</dc:creator>
				<category><![CDATA[FRI]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Classic Gaming]]></category>
		<category><![CDATA[console gaming]]></category>
		<category><![CDATA[Emulation]]></category>
		<category><![CDATA[Gaming]]></category>
		<category><![CDATA[ROMs]]></category>

		<guid isPermaLink="false">http://mypieceoftheinter.net/archives/470</guid>
		<description><![CDATA[&#160; Download Here Change Log: Fix: emulator compatibility is now caps-insensitive Fix: emulator selector centered and has correct icon Re-Write: Emulator loader re-written.&#160; The emulator selector now looks finished.&#160; Note that ROMs can no longer be opened in bulk. New Feature: Image Health (good dump, bad dump) can now be searched. New Feature: The default [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;<a href="http://mypieceoftheinter.net/wp-content/uploads/2008/04/image8.png"><img height="381" alt="image" src="http://mypieceoftheinter.net/wp-content/uploads/2008/04/image-thumb2.png" width="640" /></a>    <br /><strong><a href="http://download.somewhatgeeky.com?downloadID=fri_version_1.4.0.0">Download Here</a></strong></p>
<p><strong>Change Log:</strong></p>
<ul>
<li>Fix: emulator compatibility is now caps-insensitive </li>
<li>Fix: emulator selector centered and has correct icon </li>
<li>Re-Write: Emulator loader re-written.&#160; The emulator selector now looks finished.&#160; Note that ROMs can no longer be opened in bulk. </li>
<li>New Feature: Image Health (good dump, bad dump) can now be searched. </li>
<li>New Feature: The default size of the Advanced Search window is now just the right size to fit all of the content.      <br /><a href="http://mypieceoftheinter.net/wp-content/uploads/2008/04/image2.png"><img height="480" alt="fri version 1.4.0.0 advanced search window" src="http://mypieceoftheinter.net/wp-content/uploads/2008/04/image-thumb1.png" width="376" /></a> </li>
<li>New Feature: The default size of the Emulator Selector window is not just the right size to fit all of the content.      <br />Here is the Emulator Selector when I select a PlayStation ROM to play. (I don&#8217;t have any PlayStation emulator configured to work with FRI, so it just shows all of the emulators.)       <br /><img height="293" alt="fri version 1.4.0.0 emulator selector" src="http://mypieceoftheinter.net/wp-content/uploads/2008/04/image6.png" width="482" />       <br />Here is the Emulator Selector when I select a Game Boy ROM to play.&#160; Since I have more than one Game Boy-compatible emulator configured in FRI, it gives me a choice.       <br /><img height="182" alt="fri version 1.4.0.0 emulator selector" src="http://mypieceoftheinter.net/wp-content/uploads/2008/04/image9.png" width="487" />&#160; </li>
<li>New Feature:&#160; More-detailed status messages in the status bar.      <br /><img height="110" alt="fri version 1.4.0.0 status bar (split picture)" src="http://mypieceoftheinter.net/wp-content/uploads/2008/04/image3.png" width="590" /> </li>
<li>Tweak:&#160; Many improvements to program responsiveness.&#160; Previous versions of FRI freeze temporarily when scanning for a large number of new ROMs, or when populating the ROM list when a large number of ROMs.&#160; Various tweaks, combined with the new status bar messages, ensure that FRI remains responsive and keep the user in control. </li>
<li>New Feature: Maximum number of players can now be an implied meaning of a File Tag.&#160; This means that if a ROM has &quot;[p1]&quot; in the file name, then FRI will recognize it as a 1-player game.&#160; As always, the user can create new tags, so if the user has a lot of ROMs with &quot;(1 player)&quot; denoting that it is a 1-player ROM, then he can easily add that to the File Flag Vocabulary.      <br /><img height="316" alt="fri version 1.4.0.0 File Flag Vocabulary" src="http://mypieceoftheinter.net/wp-content/uploads/2008/04/image4.png" width="615" /> </li>
<li>New Feature:&#160; FRI now has the ability to randomly-select a ROM in the ROM-list, or (if multiple ROMs are already selected) to randomly-select a ROM out of the selected ROMs.      <br /><img height="43" alt="fri version 1.4.0.0 select random feature" src="http://mypieceoftheinter.net/wp-content/uploads/2008/04/image5.png" width="317" /> </li>
<li>New Feature: Now when FRI is closed it only saves the database if changes have been made.      <br /><img height="79" alt="fri version 1.4.0.0 smarter saving" src="http://mypieceoftheinter.net/wp-content/uploads/2008/04/image7.png" width="364" /> </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mypieceoftheinter.net/archives/470/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pi Calculator</title>
		<link>http://mypieceoftheinter.net/archives/351</link>
		<comments>http://mypieceoftheinter.net/archives/351#comments</comments>
		<pubDate>Sun, 24 Feb 2008 05:12:52 +0000</pubDate>
		<dc:creator>David McGrath</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[pi]]></category>
		<category><![CDATA[Visual Studio Express]]></category>
		<category><![CDATA[π]]></category>

		<guid isPermaLink="false">http://mypieceoftheinter.net/archives/351</guid>
		<description><![CDATA[Everyone loves π!  I was bored today, so obviously I got the urge to make a program to calculate it.  (Who doesn&#8217;t, right?)  A friend of mine has hacked one together in Java, but I feel the need to show him how it&#8217;s done in C#.  There&#8217;s nothing wrong with a little healthy competition after [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone loves π!  I was bored today, so <em>obviously</em> I got the urge to make a program to calculate it.  (Who doesn&#8217;t, right?)  A friend of mine has hacked one together in <a href="http://en.wikipedia.org/wiki/Java_%28programming_language%29">Java</a>, but I feel the need to show him how it&#8217;s done in <a href="http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29">C#</a>.  There&#8217;s nothing wrong with a little healthy competition after all.  Bring it on! <img src='http://mypieceoftheinter.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The first challenge was to figure out <em>how</em> to calculate π.  I came up with <a href="http://staff.washington.edu/skykilo/Pi/Pi.html">this</a> website.  I decided to use &#8220;Gregory&#8217;s Formula&#8221; at the bottom of the page, which is an alternating series.</p>
<p>Here&#8217;s what I saw on the website:<br />
<img width="368" src="http://mypieceoftheinter.net/wp-content/uploads/2008/02/01-equation-1.png" alt="basic concept" height="63" /></p>
<p>So that means that&#8230;<br />
<img width="181" src="http://mypieceoftheinter.net/wp-content/uploads/2008/02/02-equation-2.png" alt="intermediate equation" height="88" /></p>
<p>and finally&#8230;<br />
<img width="198" src="http://mypieceoftheinter.net/wp-content/uploads/2008/02/03-equation-3.png" alt="magical equation of awesome" height="84" /></p>
<p>The last equation is just the calculus version of the first one.  In either way the basic pattern is that I start with 1/1, subtract 1/3, add 1/5, and so on.  Then at whatever point I want multiply that resulting summation by 4 to get an approximation of π.  The fun part is translating that into code.</p>
<p>So what <em>does</em> that look like in code? Well, I made a whole PiCalculator class, but this is the part that runs over and over:<br />
<img width="382" src="http://mypieceoftheinter.net/wp-content/uploads/2008/02/04-startcalculating-method.png" alt="startCalculating method" height="293" /></p>
<p>And whenever Pi is requested, it just multiplies aFourh by 4.<br />
<img width="273" src="http://mypieceoftheinter.net/wp-content/uploads/2008/02/05-pi-accessor.png" alt="pi accessor" height="123" /></p>
<p>That&#8217;s the basic idea.  There&#8217;s more code to initiate the calculation process (and run it on a separate thread), a bunch of accessors so that the main program can get information to display, and finally there&#8217;s code to actually display all of the information.</p>
<p>When the program is first opened it looks like this:<br />
<img width="512" src="http://mypieceoftheinter.net/wp-content/uploads/2008/02/06-beginning.png" alt="inital view" height="301" /></p>
<p>It&#8217;s calculating π in the background, but for performance sake it only shows the user the values when the &#8220;Update&#8221; button or enter is pressed.<br />
<img width="521" src="http://mypieceoftheinter.net/wp-content/uploads/2008/02/07-30-seconds.png" alt="after 30 seconds" height="301" /></p>
<p>After 30 seconds it has more pi than any sane person would care about.</p>
<p>One thing I had to look out for was numbers that were too extreme.  Eventually that fraction that is being added and subtracted in the summation is going to be rounded to zero, so I account for that in the code, stopping the calculations in that event.  As you can see, though, even with my computer&#8217;s <a href="http://mypieceoftheinter.net/archives/46">Intel Core 2 Quad Q660</a>, I would have to run this program for several years to have that happen.</p>
<p>So this was a fun little project.  Feel free to try it out for yourself!</p>
<p><a href="http://download.somewhatgeeky.com?downloadID=pi_calculator_version_1.0.0.0">Download the executable here</a></p>
<p><a href="http://download.somewhatgeeky.com?downloadID=pi_calculator_version_1.0.0.0_source">Download the C# source code here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mypieceoftheinter.net/archives/351/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

