1. strange bug
- Posted by jacques deschênes <desja at globetrotter.net> Feb 13, 2007
- 500 views
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
2. Re: strange bug
- Posted by jacques deschênes <desja at globetrotter.net> Feb 13, 2007
- 533 views
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
3. Re: strange bug
- Posted by Robert Craig <rds at RapidEuphoria.com> Feb 13, 2007
- 524 views
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
4. Re: strange bug
- Posted by jacques deschênes <desja at globetrotter.net> Feb 14, 2007
- 510 views
Thanks Robert for the info.