From: Philipp E. Weidmann on
It is my understanding that gfortran doesn't provide a way to use a
record length of just a single byte with unformatted files (other
compilers do, with some variation of the "-assume byterecl" flag). While
there is an option called "-frecord-marker", it only accepts multiples
of 4 as an argument.

This is an enormous limitation, since it makes certain operations on
files very hard to do (like hashing, for example).

Is there any way to emulate "-assume byterecl" in gfortran, or a similar
compiler flag that I don't know of yet?

Thanks,

-- Philipp Emanuel Weidmann
From: dumashu on
于 2010/7/3 16:02, Philipp E. Weidmann 写道:
> It is my understanding that gfortran doesn't provide a way to use a
> record length of just a single byte with unformatted files (other
> compilers do, with some variation of the "-assume byterecl" flag). While
> there is an option called "-frecord-marker", it only accepts multiples
> of 4 as an argument.
>
> This is an enormous limitation, since it makes certain operations on
> files very hard to do (like hashing, for example).
>
> Is there any way to emulate "-assume byterecl" in gfortran, or a similar
> compiler flag that I don't know of yet?
>
> Thanks,
>
> -- Philipp Emanuel Weidmann

just use i/o stream
From: Tobias Burnus on
Philipp E. Weidmann:
> It is my understanding that gfortran doesn't provide a way to use a
> record length of just a single byte with unformatted files (other
> compilers do, with some variation of the "-assume byterecl" flag). While
> there is an option called "-frecord-marker", it only accepts multiples
> of 4 as an argument.

I think you got it backward: gfortran does not offer a way to have
direct access with recl=... / record lengths in different units than
bytes. Thus, the file storage unit is always 8 bits (=
NUMERIC_STORAGE_SIZE) for (un)formatted files. This is different to some
other compiles which default to 4-byte units for unformatted access.

> This is an enormous limitation, since it makes certain operations on
> files very hard to do (like hashing, for example).

Are you sure that you don't want to use in this case stream rather than
direct access?

Tobias
From: robin on
"Philipp E. Weidmann" <philipp.weidmann(a)gmx.de> wrote in message news:i0mqqj$uhg$1(a)news.albasani.net...
| It is my understanding that gfortran doesn't provide a way to use a
| record length of just a single byte with unformatted files (other
| compilers do, with some variation of the "-assume byterecl" flag). While
| there is an option called "-frecord-marker", it only accepts multiples
| of 4 as an argument.
|
| This is an enormous limitation, since it makes certain operations on
| files very hard to do (like hashing, for example).
|
| Is there any way to emulate "-assume byterecl" in gfortran, or a similar
| compiler flag that I don't know of yet?

Have you tried direct access, with a reord length of 1?


From: Philipp E. Weidmann on
robin wrote:
> "Philipp E. Weidmann"<philipp.weidmann(a)gmx.de> wrote in message news:i0mqqj$uhg$1(a)news.albasani.net...
> | It is my understanding that gfortran doesn't provide a way to use a
> | record length of just a single byte with unformatted files (other
> | compilers do, with some variation of the "-assume byterecl" flag). While
> | there is an option called "-frecord-marker", it only accepts multiples
> | of 4 as an argument.
> |
> | This is an enormous limitation, since it makes certain operations on
> | files very hard to do (like hashing, for example).
> |
> | Is there any way to emulate "-assume byterecl" in gfortran, or a similar
> | compiler flag that I don't know of yet?
>
> Have you tried direct access, with a reord length of 1?
>
>

Direct access is what I'm using. However, I set the record length not to
1 but to the size of the file, in order to read the entire file into a
BYTE buffer before processing it (which speeds up hashing by a factor of
at least 10).

No matter whether I use a record length of 1 or file_size (in bytes),
though, in gfortran a record length of 1 means at least 4 bytes and a
record length of file_size means at least 4*file_size.

--
-- Philipp Emanuel Weidmann