<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — Read Sudoku data]]></title>
	<link rel="self" href="http://forums.approximatrix.com/extern.php?action=feed&amp;tid=544&amp;type=atom" />
	<updated>2016-03-31T15:53:08Z</updated>
	<generator>PunBB</generator>
	<id>http://forums.approximatrix.com/viewtopic.php?id=544</id>
		<entry>
			<title type="html"><![CDATA[Re: Read Sudoku data]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=2448#p2448" />
			<content type="html"><![CDATA[<p>And it worked for me also.<br />Thanks for the fast help.</p>]]></content>
			<author>
				<name><![CDATA[Bob]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=3602</uri>
			</author>
			<updated>2016-03-31T15:53:08Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=2448#p2448</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Read Sudoku data]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=2446#p2446" />
			<content type="html"><![CDATA[<p>Bob,</p><p>So the text file looks something like:<br /></p><div class="codebox"><pre><code>006040089
145000070
...</code></pre></div><p>Is that correct?&nbsp; I was confused by your statement about storing the data in hexadecimal format.</p><p>Anyway, I think the issue is that the <em>Read</em> statement needs some sort of indicator that a record is complete before executing regardless of your <em>Format</em> specification.&nbsp; What you might do instead is eliminate your inner loop and read in an entire row with a proper <em>Format</em> spec that refers to 9 single-digit integers.&nbsp; The following worked for me:</p><div class="codebox"><pre><code>do i=1,9
    Read(5, &#039;(9I1)&#039;) (grid(i,j), j=1,9)
end do</code></pre></div><p>Feel free to switch back to using the explicit <em>Format</em> statement, but I thought it was simple enough to put right there in the <em>Read</em> statement.</p><p>Using that code, my array was filled with 9 single-digit integers properly.</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2016-03-31T12:27:58Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=2446#p2446</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Read Sudoku data]]></title>
			<link rel="alternate" href="http://forums.approximatrix.com/viewtopic.php?pid=2444#p2444" />
			<content type="html"><![CDATA[<p>I am trying to load a 9x9 sudoku grid from a text file.&nbsp; <br />The file was created in Notepad and saved as a .txt file.<br />The first row contains keyed text data 006040089 <br />and the second row contains 145000070 The data is stored <br />in Hex as <br />30 30 36 30 34 30 30 38 39 0D 0A 31 34 35 30 30 30 30 37 30 0D 0A</p><p>The following was my first unsuccessful read attempt. <br />do i=1,9<br />&nbsp; &nbsp; do j=1,9<br />&nbsp; &nbsp; &nbsp; &nbsp; Read(5,10)grid(i,j)&nbsp; <br />&nbsp; &nbsp; end do&nbsp; &nbsp;<br /> end do<br />10&nbsp; Format(I1)</p><p>All constructive advice is appreciated as I experiment.<br />Bob</p>]]></content>
			<author>
				<name><![CDATA[Bob]]></name>
				<uri>http://forums.approximatrix.com/profile.php?id=3602</uri>
			</author>
			<updated>2016-03-30T22:41:43Z</updated>
			<id>http://forums.approximatrix.com/viewtopic.php?pid=2444#p2444</id>
		</entry>
</feed>
