Topic: Read Sudoku data

I am trying to load a 9x9 sudoku grid from a text file. 
The file was created in Notepad and saved as a .txt file.
The first row contains keyed text data 006040089
and the second row contains 145000070 The data is stored
in Hex as
30 30 36 30 34 30 30 38 39 0D 0A 31 34 35 30 30 30 30 37 30 0D 0A

The following was my first unsuccessful read attempt.
do i=1,9
    do j=1,9
        Read(5,10)grid(i,j) 
    end do   
end do
10  Format(I1)

All constructive advice is appreciated as I experiment.
Bob

Re: Read Sudoku data

Bob,

So the text file looks something like:

006040089
145000070
...

Is that correct?  I was confused by your statement about storing the data in hexadecimal format.

Anyway, I think the issue is that the Read statement needs some sort of indicator that a record is complete before executing regardless of your Format specification.  What you might do instead is eliminate your inner loop and read in an entire row with a proper Format spec that refers to 9 single-digit integers.  The following worked for me:

do i=1,9
    Read(5, '(9I1)') (grid(i,j), j=1,9)
end do

Feel free to switch back to using the explicit Format statement, but I thought it was simple enough to put right there in the Read statement.

Using that code, my array was filled with 9 single-digit integers properly.

Jeff Armstrong
Approximatrix, LLC

Re: Read Sudoku data

And it worked for me also.
Thanks for the fast help.