Re: The concept of a record



On Jan 30, 2:57 pm, dpb <n...@xxxxxxx> wrote:

Where you have a problem is that if you OPEN the file in Fortran as
UNFORMATTED there is some internal Fortran file record structure (in
short, required to support Fortran operations like BACKSPACE) that
Matlab's fread() is not expecting.

To write a file for the purpose, you need stream or so-called "binary"
i/o. To achieve this depends on the compiler as it was not a standard
facility until the '03 Standard.

Check your compiler documentation for details of transferring files to
other systems--normally there will be an example of how to accomplish
the task. If that fails, post the particular compiler and somebody here
will undoubtedly know the proper incantation.

--

dpb, thank you for pointing this out to me. Indeed I had trouble at
the first try. I noticed your post, and looked up about "stream I/O",
and I found a tutorial on it by Clive Page. From that tutorial, I
learned that stream I/O has been implemented by g95 compiler, which is
what I am using. What I did is just add access="stream" to the open
statement, and then everything works all right.

.



Relevant Pages

  • Re: PL/I features
    ... Early commercial I/O could use stream. ... channel and dropped directly into the buffer where PL/I then read it. ... Both the compiler and compiled code had to reside ...
    (comp.lang.pl1)
  • Re: If you got to choose the syntax, what would you do?
    ... pretty common these days, so I should put in a few thoughts. ... Do they execute the tokens serially from the stream or do they ... execute tokens from the outside world, or put a Forth compiler in there ...
    (comp.lang.forth)
  • Re: Modularity problems with multiple dispatch
    ... expected to persevere under any compiler mojo that goes on. ... and Haskell doesn't do that. ... about I/O and the IO type prevents the compiler from reordering I/O ... The IO monad introduces false dependencies into ...
    (comp.lang.functional)
  • Re: Doubts about appending data to a file
    ... because n is not available to the Fortran ... out that the compiler can disallow any I/O statement that... ... I am disinclined to use BACKSPACE. ...
    (comp.lang.fortran)
  • Re: String handling in .txt file.
    ... > have been developed with some compiler specific syntax. ... I don't think you have a syntax issue, ... > text stream to a printer on LPT1. ... > characters that cause the routine to abort. ...
    (alt.comp.lang.learn.c-cpp)