How to handle the ArrowKeys

S

sravan_reddy001

how can i handle the arrowkeys whether they are pressed or not.

i had used the w,s,a,d keys to do that function. I want to make that
with the help of ArrowKeys
 
O

osmium

sravan_reddy001 said:
how can i handle the arrowkeys whether they are pressed or not.

i had used the w,s,a,d keys to do that function. I want to make that
with the help of ArrowKeys

Use of the arrow keys is dependant on your OS and your compiler, this group
is generic C only. Look up "scan code" and then post your question to a
more appropriate newsgroup.
 
M

Malcolm McLean

sravan_reddy001 said:
how can i handle the arrowkeys whether they are pressed or not.

i had used the w,s,a,d keys to do that function. I want to make that
with the help of ArrowKeys
ANSI C offers a line-based interface to the keyboard. User composes a line,
types return, and the full line is fed to the program. It is very good for a
lot of purposes, but not for interactive graphics.

However curses on Unix or conio on DOS / Windows will offer a function
called kbhit which probably does what you want. There are ways of getting
arrow keys by specifying key codes rather than characters. However don't ask
me about the details, it is so long since I've used it.
 
M

Mark McIntyre

how can i handle the arrowkeys whether they are pressed or not.

i had used the w,s,a,d keys to do that function. I want to make that
with the help of ArrowKeys

This is a FAQ
 
W

Walter Roberson

Malcolm McLean said:
ANSI C offers a line-based interface to the keyboard. User composes a line,
types return, and the full line is fed to the program.

ANSI C makes no promises about the ability to "compose" a line,
and doesn't promise that "return" is the mechanism to send a line
to a program. For example, on some systems, it is "Enter" (which
may, for example, correspond to "newline" rather than to "return")
 
S

sravan_reddy001

i'm using the kbhit() function and i want to check which of the
arrowkeys is pressed and call the appropriate function.

Turbo C++ Compiler/Windows XP
 
F

Flash Gordon

sravan_reddy001 wrote, On 25/06/07 03:22:
i'm using the kbhit() function and i want to check which of the
arrowkeys is pressed and call the appropriate function.

Turbo C++ Compiler/Windows XP

Then ask on a Windows and/or Turbo C++ group.
 
D

Default User

sravan_reddy001 said:
i'm using the kbhit() function and i want to check which of the
arrowkeys is pressed and call the appropriate function.

Turbo C++ Compiler/Windows XP

Then find a Borland group. Compiler-specific questions are off-topic
here.



Brian
 
R

Richard Bos

ANSI C offers a line-based interface to the keyboard. User composes a line,
types return, and the full line is fed to the program. It is very good for a
lot of purposes, but not for interactive graphics.

However curses on Unix or conio on DOS / Windows will offer a function
called kbhit which probably does what you want.

That is subtly wrong, which is a good example of why it is usually a bad
idea to post off-topic advice here. curses on Unix _and_ many other
systems, including MS-DOS and probably MS Windows, and conio on MS-DOS/
MS Windows offer _functions_ called kbhit(). These functions are not
identical. You cannot use one as a drop-in replacement for the other.

Richard
 
R

Richard Heathfield

Malcolm McLean said:
ANSI C offers a line-based interface to the keyboard.

No, it doesn't. It offers an interface to the standard input stream,
which may or may not get its data from a keyboard.

<snip>
 
C

CBFalconer

sravan_reddy001 said:
i'm using the kbhit() function and i want to check which of the
arrowkeys is pressed and call the appropriate function.

Turbo C++ Compiler/Windows XP

There is no 'kbhit' function in standard C. Use a newsgroup that
deals with your peculiar system.
 
S

Spiros Bousbouras

That is subtly wrong, which is a good example of why it is usually a bad
idea to post off-topic advice here. curses on Unix _and_ many other
systems, including MS-DOS and probably MS Windows, and conio on MS-DOS/
MS Windows offer _functions_ called kbhit(). These functions are not
identical. You cannot use one as a drop-in replacement for the other.

OOT {
There's no kbhit() function in Unix curses.
}
 
R

Richard Bos

Spiros Bousbouras said:
OOT {
There's no kbhit() function in Unix curses.
}

I must have been thinking of another function, then. Only reinforces the
point that this is not the place to ask about curses _or_ conio, though,
let alone about curses _and_ conio.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top