Re: Fortran 77: Reading empty string
- From: "artheartscience" <steve@xxxxxxxxxxxxxxx>
- Date: 31 Jan 2006 12:08:40 -0800
Wow, thanks for all the info! Everything is working great now.
Richard E Maine wrote:
> artheartscience <steve@xxxxxxxxxxxxxxx> wrote:
>
> > in my READ statement I
> > supplied the END=13 which means "if the user just presses enter, goto
> > line 13".
>
> First, no. It does not mean anything close to that. The end= detects an
> end-of file. Pressing the enter key does not generate and end of file.
> It just generates a record - an empty one, but still a record. You won't
> "normally" see an end-of-file on an interactive terminal, because there
> is always the possibility that the user will type more input. On a unix
> system, control-D will typically generate an interactive end-of-file,
> but that's not what I'd call "normal".
>
> > That means just proceed as normal...passing the empty string
> > to the FA function should work,
>
> I haven't seen the FA function (if it was in a previous post, I didn't
> go back and check), but your terminilogy here makes me suspicious. There
> is no such thing in f77 as an "empty" string. There can be an empty
> record, but not an empty string. There can be a string full of blanks,
> but that isn't the same thing as "empty". Quite the opposite, it is
> "full"; what it is full of happens to be blanks, but those are perfectly
> valid characters.
>
> > READ(*, END=13) str
>
> Two problems with this line. First is the one that the erro rmessage
> bitched about. You don't have a format here. A format specification is
> *REQUIRED* for a formatted file. You might be intending the * to be the
> format specification, but it isn't. The * here is the unit "number" (*
> being a special case to denote the standard input unit). You might have
> intended
>
> read(*,*,end=13) string
>
> but that has another problem, namely that list-directed formatting (the
> *) is a poor choice here. It will keep "searching" until it finds a line
> with some input on it, which is not at all the behavior you want. You
> probably want something more like
>
> read(*,'(a)') string
>
> where I have also taken off the end=, which is pretty useless here
> unless you really did want to detect control-D.
>
> --
> 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
.
- References:
- Fortran 77: Reading empty string
- From: artheartscience
- Re: Fortran 77: Reading empty string
- From: Richard E Maine
- Fortran 77: Reading empty string
- Prev by Date: Re: save attribute for module variables
- Next by Date: Re: How to detect NULL input?
- Previous by thread: Re: Fortran 77: Reading empty string
- Next by thread: Detect undefined real variables?
- Index(es):