This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: binary/unformatted stdin


2010/4/6 Konstantin Kuzvesov <kuzvesov@list.ru>:
> Hello,
>
> Âhow can I get unformatted stdin in gfortran? I'm trying to do it this way:

That I need to leave to the IO experts around here ...

> Â Âopen(unit=5, form='unformatted'
>
> Âbut I get an error:
>
> Â ÂAt line 4 of file test.for (unit = 5, file = 'stdin'
> Â ÂFortran runtime error: Cannot change FORM parameter in OPEN statement

... but this is pretty clear: the stdin unit is preconnected by the
compiler, so gfortran is unhappy at runtime, because you are trying to
change access type by re-opening an already opened unit.

Just a pretty wild guess: does closing stdin and re-opening it work? I
think I've seen something about stdin manipulation on this list
before.

> ÂI need to transfer a large amount of doubles (totally sized around a gig)
> Âto fortran program via a pipe, so converting it to text forth and back is no good.

You could always just dump that into a binary file and open it to
circumvent the need for painful stdin contortions, if interoperability
is not an issue.

Cheers,
Dennis


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]