Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!mp.cs.niu.edu!ux1.cso.uiuc.edu!uxa.cso.uiuc.edu!jb10320 From: jb10320@uxa.cso.uiuc.edu (Jawaid Bazyar) Newsgroups: comp.sys.apple2 Subject: Re: Orca/C bug? Message-ID: <1991May22.225351.13303@ux1.cso.uiuc.edu> Date: 22 May 91 22:53:51 GMT References: <9105221206.AA02966@apple.com> Sender: usenet@ux1.cso.uiuc.edu (News) Organization: University of Illinois at Urbana Lines: 44 HB03932@SWTEXAS.BITNET writes: >Here is a quick little question for you "C" guys out there: >I am finally getting around to learning "C", but I am having >problems getting the getkey() function to work (i.e. you have >to hit return/enter to have it "get" the first character). >I was wondering if this is a bug in Orca/C (yeah, I have the >original version). Is it fixed in the upgrades. Is there a >way to re-define it on the version I have? getkey()? There is no getkey defined as part of the C standard. Perhaps you mean getchar()... getchar() (and in fact all of the C I/O routines) buffer input- in this particular case, the line you're typing. Many systems have a way to put the I/O routines in a 'raw' mode, so you can get single characters at a time, but I don't believe Orca/C supports this. Here's a little routine that will wait for and get a character from the keyboard (sorry, no cursor displayed- but you can set one up by printing an inverse space). char getkey() { char c = 0; asm { sep 0x20 loop: lda 0xE1C000 bpl loop and #0x7f sta c lda 0xE1C010 rep 0x20 } return (char) c; } Yes, it's assembly, but I've been using this for a couple years with no problem. -- Jawaid Bazyar | "Twenty seven faces- with their eyes turned to Graduated!/Comp Engineering | the sky. I have got a camera, and an airtight bazyar@cs.uiuc.edu | alibi.." Apple II Forever! | I need a job... Be privileged to pay me! :-)