Re: Program compiled on intel acting weired

From: Richard Maine (nospam_at_see.signature)
Date: 04/20/04

  • Next message: Al Worth: "Re: Microsoft Fortran Powerstation"
    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
    

  • Next message: Al Worth: "Re: Microsoft Fortran Powerstation"

    Relevant Pages

    • Re: Aligning output columns using tabs
      ... The output file ... I'd suggest reading about format. ... with blanks, ...
      (comp.lang.tcl)
    • Re: Simple csv read/write
      ... For some reason, every other row on the output file is a ... writer = csv.writer) ... Try reading the responses already posted to your previous questions. ...
      (comp.lang.python)
    • "Faster" I/O in a script
      ... script is fairly simple. ... It reads a line form the input file, ... algorithms goes ahead and writes them one by one on the output file. ... "batch-like" way so I will avoid the constant line by line reading? ...
      (comp.lang.python)
    • Backup procedure...
      ... I´m looking for a backup procedure to make a backup operation and ... put output to my terminal and a output file too. ... now reading b20030401 saveset ...
      (comp.os.vms)
    • Re: hex represenation from string in perl
      ... I tried reading the FAQ, ... > It is out of frustration and wanting to learn. ... What was wrong with the suggestion John gave you? ...
      (comp.lang.perl.misc)