RE: Problem with gets(0)

new topic     » topic index » view thread      » older message » newer message

this happens when you get to the bottom of the screen. the problem is in 
prompt_number. after gets is called, it outputs a newline because for 
some sick reason, gets only outputs one when you get to the bottom of 
the screen

rforno at tutopia.com wrote:
> Rob:
> I was debugging a large program, and found a strange behavior of
> prompt_number(). Then I traced the problem to the gets(0) routine in
> prompt_number().
> After CR is hit, gets(0) obtains the input number correctly, but at 
> times it
> outputs a CR to the screen and at times it does not.
> This happens exactly at the same place in the program, depending on the
> sentences that have been executed previously. I include the procedure I
> call and a fragment of a large procedure:
> 
> 
> procedure Ask_relcode(integer k)
> --Requests a relative field code for indexed texts
>     atom n
>     if length(lastin) = 0 then --If this is the first time
>      n = 0.5
>      while not integer(n) do
>          n = prompt_number("\nWhich is the field number to reference? ",
>               {1, length(relcodes)})
>          if not integer(n) then
>               printf(1, "%s %f\n", {"Not an integer:", n})
>          end if
>      end while
>      relcodes[k] = n
>     end if
> end procedure
> 
> procedure large_procedure()
> -- Something
>     Ask_relcode(k)
> -- Something
> end procedure
> 
> I have been unable to reproduce the problem with a smaller program. If
> necessary, I can mail you the entire program.
> 
>

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu