Re: Program compiled on intel acting weired
From: Richard Maine (nospam_at_see.signature)
Date: 04/20/04
- Previous message: Richard Maine: "Re: G95 is OK to *learn* Fortran?"
- In reply to: MISHAL ALHARBI: "Program compiled on intel acting weired"
- Next in thread: MISHAL ALHARBI: "Re: Program compiled on intel acting weired"
- Reply: MISHAL ALHARBI: "Re: Program compiled on intel acting weired"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 19 Apr 2004 16:01:51 -0700
"MISHAL ALHARBI" <mishal@verizon.net> writes:
> 3- program then will give the error " read after write" and exit
>
> I have to say that I ran out of ideas to debug it,
Well, are you in fact ever reading from this file? If so,
that is likely to be a problem. Reading from the standard
output file is problematic at best. I'd first trace down
what statement is causing the error. (I'm not enough of
a CVF or Intel Fortran expert to give you any specialized
advise on how to do that other than the obvious generic
approaches.) If that is a READ statement and it is
indeed reading from the output file, then you'll need to
do some digging to figure out what it is really trying to
do.
The problem that the message refers to is that if the last
thing you did to a file was write to it, you will be at the
end of the file, so reading will never make sense. You'd
need to rewind or backspace first in order to have any chance
of being useful. But in your case, if this file is the
standard output file, that adds extra complications.
> anyone have any idea why
> a program would even direct a terminal write into a file ?
There are *LOTS* of possible reasons for that. So many that I find it
hard to name just one or two. Since pretty much every current shell
has special syntax to achieve things like that, its a pretty good
guess that someone somewhere might have had a reason to want it. :-)
Start with
1. Wanting a permament record of something.
2. Having an output to large for a single screen.
3. Wanting to process the output with some other program.
4. Etc, etc.
And yes, these all apply to output that might, in some other
situation, go directly to a terminal screen.
In my own production code I avoid writing to unit * particularly
because that makes it so compiler-dependent how to deal with
redirecting it. I find it a lot easier to do redirection by
using a variable for the unit number. Then, I can open a
different unit and set the variable to that new unit number;
that is far more portable than figuring out how to make
unit 6 (or whatever, but usually 6) refer to some other file.
-- Richard Maine | Good judgment comes from experience; email: my first.last at org.domain | experience comes from bad judgment. org: nasa, domain: gov | -- Mark Twain
- Previous message: Richard Maine: "Re: G95 is OK to *learn* Fortran?"
- In reply to: MISHAL ALHARBI: "Program compiled on intel acting weired"
- Next in thread: MISHAL ALHARBI: "Re: Program compiled on intel acting weired"
- Reply: MISHAL ALHARBI: "Re: Program compiled on intel acting weired"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|