Re: reading binary data with continuations
- From: George <george@xxxxxxxxxxxxxxx>
- Date: Wed, 19 Nov 2008 17:17:53 -0700
On Tue, 18 Nov 2008 07:21:54 -0500, Herman D. Knoble wrote:
On Mon, 17 Nov 2008 22:04:42 -0700, George <george@xxxxxxxxxxxxxxx> wrote:
-|Thanks in advance,
George, george.txt is the file you posted with sequence numbers and
strings of 0's and 1's. The following will free format read such a file and
display the 01 strings.
Again, thanks, Skip, this put me on the scoreboard right away:
character(len=100) line
integer :: seqnum, eof
open(unit=50,file='george.txt',form='formatted')
do
read(50,*,iostat=eof)seqnum, line
if (eof /= 0) exit
write(*,*) trim(line)
end do
close(unit=50)
endprogram
! g95 skip1.f03 -o x.exe
C:\MinGW\source>g95 skip1.f03 -o x.exe
C:\MinGW\source>x
0001000000000000001
0001000000000000001
10000011001000000000000001
10000011001000000000000001
10000011001000000000000001
10000011001000000000000001
10000011001000000000000001
10000011001000000000000001
10000011001000000000000001
10000011001000000000000001
100000001111100
100000001111100
100000001111100
1000001110110111100000000000001
1000001110110111100000000000001
1000001110110111100000000000001
1000001110110111100000000000001
1000001110110111100000000000001
1000001110110111100000000000001
0001000000000000001
C:\MinGW\source>g95 skip1.f03 -o x.exe
The only syntax change I made to your program was to write "endprogram"
without whitespace. I covered up to page 50 today in _Fortran 2003_, and I
was a little surprised about things that were/were not kosher, and at what
time.
I haven't done input with fortran in decades. Now, I've got to herd these
creatures into octets.
--
George
The momentum of freedom in our world is unmistakable - and it is not
carried forward by our power alone. We can trust in that greater power Who
guides the unfolding of the years. And in all that is to come, we can know
that His purposes are just and true.
George W. Bush
Picture of the Day http://apod.nasa.gov/apod/
.
- References:
- reading binary data with continuations
- From: George
- Re: reading binary data with continuations
- From: Herman D . Knoble
- reading binary data with continuations
- Prev by Date: Re: Check for empty string
- Next by Date: Re: reading binary data with continuations
- Previous by thread: Re: reading binary data with continuations
- Next by thread: Re: reading binary data with continuations
- Index(es):
Relevant Pages
|