Re: fmt: read unexpected character



Wolfi <sfsdf.dfdsf@xxxxxxxxx> wrote:

if (line(i:i+3) .eq. 'rows') then
read (line(i+4:i+6),1011) maxline *HERE IS LINE 23
1011 format (i3)
.....
At line 23 of file Begin.redhat.f
Fortran runtime error: Bad value during integer read

As others have noted, the problem here appears to have much more to do
with the portability of the non-Fortran elements of the code than with
Fortran. This code looks for an integer in the 3 characters imediately
following the string "rows" in the output of stty. That actually seems a
bit questionable in robustness for any OS. If the number of rows is more
than 99, as is plausible enough, should one expect 3 characters jammed
right up against the label as in "rows100"? That's what it looks like
this code expects.

When I run stty -s on this Mac, I see an output that looks like "rows;
100". That is the two characters immediately following "rows" are a
semicolon and a blank. Odds are that the semicolon is what your message
is complaining about, as a semicolon indeed is not a valid character in
an integer value.

Without spending more time researching the exact specs for stty, I'd be
reluctant to guarantee any particulat column numbers. For example, I
don't know whether the output would be shifted over by a column or not
if my number of rows took only 2 digits. If it were my code, I'd
probably try to pick out the numeric field by using blanks as
delimitters instead of by hard-wiring exact columns.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
.



Relevant Pages

  • Re: remote [ssh] Backspace] key gives me "^?"
    ... It's possible that stty ... I will either buy a fancyy clicky keyboard or write a CLICK ... Characters are not erased for me when I hit backspace in vi. ... The thing I don't like about vim ...
    (freebsd-questions)
  • RE: FUNCTION in easyer format
    ... the code below is 234 characters which will work in excel. ... semicolon with commas. ...
    (microsoft.public.excel.programming)
  • Re: Changing my login directory
    ... R> No need for any external programs. ... no need to hit return] ... R> stty cbreak -echo ... Handles mapping characters to upper/lowercase, timeouts, default ...
    (freebsd-questions)
  • Re: Overstrike not working
    ... Word MVP FAQ site: http://word.mvps.org ... >>Alt+0xxx works only for ASCII characters. ... >>a semicolon between the characters instead of a comma. ...
    (microsoft.public.word.pagelayout)
  • Re: sscanf question
    ... more than 31 characters. ... we have a semicolon by ... C has another kind of statement called an iteration statement. ... int main ...
    (comp.lang.c)