<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Approximatrix Forums — Read statement issues]]></title>
	<link rel="self" href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=593&amp;type=atom" />
	<updated>2016-11-21T12:33:30Z</updated>
	<generator>PunBB</generator>
	<id>https://forums.approximatrix.com/viewtopic.php?id=593</id>
		<entry>
			<title type="html"><![CDATA[Re: Read statement issues]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=2698#p2698" />
			<content type="html"><![CDATA[<p>Bob,</p><p>I&#039;m not having that issue with your code.&nbsp; My grid file contains:</p><div class="codebox"><pre><code>000600400
700003600
000091080
000000000
050180003
000306045
040200060
903000000
020000100</code></pre></div><p>and my program is:</p><div class="codebox"><pre><code>program sud2
implicit none

integer, dimension (9, 9) :: grid

    integer :: i
    integer :: j
    OPEN (UNIT=5,FILE=&#039;Grid92.txt&#039;)
    do i=1,9
           Read(5, &#039;(9I1)&#039;) (grid(i,j), j=1,9)
           Print *, (grid(i,j), j=1,9)
    end do
    close(5)
        
end program sud2</code></pre></div><p>When I run this code, I get:</p><div class="codebox"><pre><code>           0           0           0           6           0           0           4           0           0
           7           0           0           0           0           3           6           0           0
           0           0           0           0           9           1           0           8           0
           0           0           0           0           0           0           0           0           0
           0           5           0           1           8           0           0           0           3
           0           0           0           3           0           6           0           4           5
           0           4           0           2           0           0           0           6           0
           9           0           3           0           0           0           0           0           0
           0           2           0           0           0           0           1           0           0</code></pre></div><p>as I would expect to.&nbsp; I would point out that using <em>UNIT=5</em> can be dangerous, and I don&#039;t recommend it normally.&nbsp; What version of Simply Fortran are you working with?</p>]]></content>
			<author>
				<name><![CDATA[jeff]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=2</uri>
			</author>
			<updated>2016-11-21T12:33:30Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=2698#p2698</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Read statement issues]]></title>
			<link rel="alternate" href="https://forums.approximatrix.com/viewtopic.php?pid=2697#p2697" />
			<content type="html"><![CDATA[<p>000600400<br />700003600<br />000091080<br />000000000<br />050180003<br />000306045<br />040200060<br />903000000<br />020000100<br />xxxxxxxxx<br />xxxxxxxxx</p><p>Above is a win10 notepad&nbsp; text file read by<br />relevant code which follows:<br />! Sudoku Grid<br />integer, dimension (9, 9) :: grid<br />implicit none<br />&nbsp; &nbsp; integer :: i<br />&nbsp; &nbsp; integer :: j<br />OPEN (UNIT=5,FILE=&#039;D:\\Grid92.txt&#039;)<br />do i=1,9 <br />&nbsp; &nbsp; &nbsp; &nbsp;Read(5, &#039;(9I1)&#039;) (grid(i,j), j=1,9)<br />end do</p><p>If you remove the two x lines<br />does the read statement&nbsp; fail ?<br />If so, why ?<br />Bob</p>]]></content>
			<author>
				<name><![CDATA[Bob]]></name>
				<uri>https://forums.approximatrix.com/profile.php?id=3602</uri>
			</author>
			<updated>2016-11-19T00:44:44Z</updated>
			<id>https://forums.approximatrix.com/viewtopic.php?pid=2697#p2697</id>
		</entry>
</feed>
