1. strange bug

I have written a console application for windows. The binded it and it works
fine. The I decided to convert to C using ecw.exe. When I run the conververted
version I have to press <ENTER> two times to confirm a line input.

I tested it with another console application and have the same bug. Both use
get_key() to read the keyboard input.

Jacques Deschênes

new topic     » topic index » view message » categorize

2. Re: strange bug

here a sample code to demonstrate the bug.
--testing

function input_line()
integer c
sequence line
   line = ""
   c = get_key()
   while c != 13 do
     if c >= 32 and c<=256 then
       line &= c
       puts(1,c)
     end if
     c = get_key()
   end while
   puts(1,'\n')
   return line&'\n'
end function

sequence iline
iline = input_line()
while length(iline)>1 do
  puts(1,iline)
  iline = input_line()
end while


if executed as exwc  test_input.exw, it works fine.
translate it to C and run the executable.
Then one have to press <ENTER> two times to complete to exit input_line()

Jacques Deschênes

new topic     » goto parent     » topic index » view message » categorize

3. Re: strange bug

jacques deschênes wrote:
> here a sample code to demonstrate the bug.
> }}}
<eucode>
> --testing
> 
> function input_line()
> integer c
> sequence line
>    line = ""
>    c = get_key()
>    while c != 13 do
>      if c >= 32 and c<=256 then
>        line &= c
>        puts(1,c)
>      end if
>      c = get_key()
>    end while
>    puts(1,'\n')
>    return line&'\n'
> end function
> 
> sequence iline
> iline = input_line()
> while length(iline)>1 do
>   puts(1,iline)
>   iline = input_line()
> end while
> </eucode>
{{{

> 
> if executed as exwc  test_input.exw, it works fine.
> translate it to C and run the executable.
> Then one have to press <ENTER> two times to complete to exit input_line()

That's a known bug when you translate and compile with Borland (or Lcc).

 From my old rough notes (which I should really add to SourceForge):

  "Things compiled by Borland (or Lcc):
   get_key() requires an extra keypress (even Shift key is enough)
   before it responds to the first keystroke.
   gets(0) and getc(0) seem ok."

I don't know how to fix it. 
Maybe someone can read the Euphoria source and figure this out.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

4. Re: strange bug

Thanks Robert for the info.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu