delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/09/30/12:54:03

Date: Wed, 30 Sep 92 17:54:45 GMT
From: kuku AT acds DOT physik DOT rwth-aachen DOT de (Christoph Kukulies)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: again binary files

My problems regarding binary files and f2c will not come to an end.
Here a piece of code which definitely fails with the current tpf2c100
in the 1.08 distribution.

The interesting this is that it occurs only when more than 20
(still the good old 20 file limit striking again?) are open.

It seems that f2c fails doing binary i/o on file handles being allocated
when the standard 20 file handle contingent is exhausted.

        program foo
        integer*2 kpx(2)
        data kpx/10,0/
        do 1 i=7,30
        open(unit=i)
   1    continue
        open(unit=4,file='test.dat', access='direct',
     $form='unformatted',recl=4)
        write(4,rec=1) kpx
        read(4,rec=1) kpx
        write(*,*)kpx(1),kpx(2)
        end
        
The program should read back 10 0 but actually it gets 2573 0 which
is an indication that something with fseek or write/fwrite must
be broken.

I'm presently trying to break this down to a small C program. I'll
come back soon.


--Chris

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019