1
votes

I read a binary file and want to specify the position in read statement:

READ(IOUNIT,IOSTAT=IOSTAT, POS=POSITION)

What I'm wondering is the type of POSITION. All examples I was was able to find had POSITION declared as a 4 byte integer. Is it possible to have it an 8 byte integer?

1
Welcome, please take the tour. Use tag fortran for all Fortran questions. You should show more code, please confirm, are you using ˋaccess="stream"ˋ? - Vladimir F

1 Answers

0
votes

Under the Fortran standard (Fortran 2018, R1213, 12.6.2.1; similar back to Fortran 2003) , the POS= specifier to the read statement must be a scalar integer expression. There is no specific restriction on the kind of that integer.

If your Fortran processor supports 8-byte integers then such an integer can be used in the specifier where that specifier is supported (in particular, under stream access, hence Fortran 2003 being mentioned earlier).