[R] Problem with writeBin and importing into gfortran compiled programs
jgarcia at ija.csic.es
jgarcia at ija.csic.es
Thu Jan 7 23:05:29 CET 2010
Solved!!
Berend's suggestion to use ACCESS='STREAM' is perfect. I've checked that
it's even acepted by gfortran coming along with GCC 4.2.1 (the one I've
got), and solves the problem.
I was working around this through seek() and truncate(), but this is
clearly the star option!
Thanks Berend and Duncan,
Javier
---
>
> jgarcia-2 wrote:
>>
>> f90 part
>> ------------
>> PROGRAM foo
>> INTEGER, PARAMETER :: DP = KIND(1.0D0)
>> INTEGER :: status
>> REAL(DP), DIMENSION(10,100) :: whini
>> OPEN(UNIT=5, FILE='fwhini.dat', STATUS='OLD', ACTION='READ', &
>> FORM='UNFORMATTED', IOSTAT=status)
>> READ(5) whini
>> CLOSE(5)
>> WRITE(*,*) whini
>> END PROGRAM
>>
>
> I am browsing in the Gfortran 4.3.0 manual.
> On page 13 there is a mention of a record marker in unformatted files.
> It could be that the fortran read is expecting a record marker every so
> many
> bytes.
> writeBin most likely has not written any record marker.
>
> In Fortran 2003 there is a new specifier ACCESS='STREAM' (similar to
> Lahey
> Fortran ACCESS='TRANSPARENT')(see page 23 of said manual) which will allow
> reading files with no record structure.
>
> Berend
> --
> View this message in context:
> http://n4.nabble.com/Problem-with-writeBin-and-importing-into-gfortran-compiled-programs-tp1009121p1009211.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list