[R] Problem with writeBin and importing into gfortran compiled programs

2010-01-07 Thread jgarcia
Hi all, I'm having problems trying to export binary arrays from R and importing them into fortran (linux openSUSE 10.3 (x86_64), gfortran compiler, fortran 90/95 program). Let's say the problem can be expressed as: R part whini - runif(1000) writeBin(whini,fwhini.dat) f90 part

Re: [R] Problem with writeBin and importing into gfortran compiled programs

2010-01-07 Thread Duncan Murdoch
On 07/01/2010 2:05 PM, jgar...@ija.csic.es wrote: Hi all, I'm having problems trying to export binary arrays from R and importing them into fortran (linux openSUSE 10.3 (x86_64), gfortran compiler, fortran 90/95 program). Let's say the problem can be expressed as: R part whini -

Re: [R] Problem with writeBin and importing into gfortran compiled programs

2010-01-07 Thread Berend Hasselman
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(*,*)

Re: [R] Problem with writeBin and importing into gfortran compiled programs

2010-01-07 Thread jgarcia
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