Re: The concept of a record
- From: Gordon Sande <g.sande@xxxxxxxxxxxxxxxx>
- Date: Wed, 30 Jan 2008 18:22:37 GMT
On 2008-01-30 13:32:26 -0400, qsc <qingshan.chen@xxxxxxxxx> said:
I found it hard to understand the concept of a record in Fortran I/O.
It is a very old concept that can be thought of as the formalization
of punch cards. You can look at the beginning of a punch card and get
the next card without bothering to look at the end of the previous one.
Here are some of the questions I have about it.
1. one record is equivalent to one line?
Yes, for the simple cases. Assuming some reasonable meaning for line.
See below for one possible trouble even with that.
2. Each read, write or print statement deal transfer one record?
Yes, for the simple cases. Some fancy formats or advance="no" are
not simple cases. There is "new record" format item and advance="no"
stays on the same record. Both are useful once you get beyond the
common simple cases.
3. What if in one write statement I want output several values? Will
they be treated as one record,
Yes, A record can have many values in in it.
or splitted into several? For example:
write(12) U(:)
No. Unless you do something quite strange. No easy examples of what that
might be.
Notice that I want binary output, and the array U have many
components. So now, will U be written in one record, or many? Will the
output be on one line, or many?
Unformatted output (what you probably mean by binary as every thing
on a binary computer is in binary) and lines are probaly a symptom
of some confusion. What you see in a text editor is often not a
record as "line wrapping" will turn a long line (often a record)
into many lines on the display. Using a text editor with unformatted
records is typically not useful except when the data is characters.
Formatted output is when you convert the internal values into a form
that is suitable for people to read. It may use either an explicit
format (what many folks call formatted output) or allow the system
to choose a format when you ask for list directed (a "*" usually)
output. Both are formatted within the meanings established for Fortran.
This technical usage is often used incorrectly and leads to repeated
confusion.
Thanks in advance!
.
- References:
- The concept of a record
- From: qsc
- The concept of a record
- Prev by Date: Re: Allocatable Arrays As Outputs
- Next by Date: Re: The concept of a record
- Previous by thread: The concept of a record
- Next by thread: Re: The concept of a record
- Index(es):
Relevant Pages
|
|