Home > Archive > Fortran > October 2004 > ascii & newlines in unformatted file
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
ascii & newlines in unformatted file
|
|
| Giorgos Momferratos 2004-10-13, 3:59 pm |
| I am trying to write a dataset in binary vtk file.
The format of the vtk file should be:
# vtk DataFile Version 2.0
Comment line
BINARY
DATASET STRUCTURED_GRID
DIMENSIONS 20 20 1
POINTS 400 double
<point coordinates in binary>
.....
POINT_DATA 400
FIELD metrics 1
area 1 400 double
<"area" dataset in binary>
EOF
Whitespace and newlines are important.
How can I write this file without closing it and re-opening to
append? Another question is whether the values put by the
unformatted write in the file are those that a library written in
c++ (VTK) would expect to find there. I am not even sure that the
size of a single value is 4 bytes, as it should be.
I am using x86 linux and ifort 8.0, portability is not an issue.
| |
| meek@skyway.usask.ca 2004-10-13, 3:59 pm |
| In a previous article, Giorgos Momferratos <mc01627@mail.ntua.gr> wrote:
>I am trying to write a dataset in binary vtk file.
>The format of the vtk file should be:
>
># vtk DataFile Version 2.0
>Comment line
>BINARY
>DATASET STRUCTURED_GRID
>DIMENSIONS 20 20 1
>POINTS 400 double
><point coordinates in binary>
>....
>POINT_DATA 400
>FIELD metrics 1
>area 1 400 double
><"area" dataset in binary>
>EOF
>
>Whitespace and newlines are important.
>How can I write this file without closing it and re-opening to
>append? Another question is whether the values put by the
>unformatted write in the file are those that a library written in
>c++ (VTK) would expect to find there. I am not even sure that the
>size of a single value is 4 bytes, as it should be.
>I am using x86 linux and ifort 8.0, portability is not an issue.
If I were doing that I would choose either unformatted -
all binary - and make up your own CR LF as necessary
or
do all formatted and use hex for the binary part (e.g. z8 or whatever)
You might have to write a translation ... but better that
than mixing formatted and unf.
Chris
|
|
|
|
|