Re: reading binary data with continuations



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/
.



Relevant Pages

  • Re: F77/C integration : strings
    ... the standard header for malloc is. ... pointer *value* to getString, which then stores the pointer to ... If you mean to treat this as CHARACTER*9 in Fortran you only need to ... Only if you want "hybrid" strings that have the padded value ...
    (comp.lang.fortran)
  • Re: Passing User Defined Types from VB to Fortran
    ... new front end using VB and have the VB code call the Fortran entry ... arrays of UDTs only - unable to figure out how to handle a large volume ... UDT with included strings and arrays. ...
    (comp.lang.fortran)
  • Re: Breedlove Atlas Series
    ... > George Gleason wrote: ... the bridge height determines the angle at which the strings enter the top ...
    (rec.music.makers.guitar.acoustic)
  • Re: read(5,*) problem?
    ... >> I can see no reason that your faith in Fortran should be shaken thereby. ... (I presume that you also don't want it interpreted as a divide in I/O ... The spaces are also lot allowed in undelimited strings. ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)
  • Re: bash script and standard input
    ... If the executable requires four different input strings, ... you can redirct the standard input to read from a ... Note that sometimes programs (why does the word "fortran" trigger this ... Josef Möllers ...
    (comp.os.linux.development.apps)