Hello, greetings from Argentina.
My question is how do I make the directional arrows works in a program built in Borland C.
Many thanks for your help
P.D: If anyone knows, please, write a simple code working
Hello, greetings from Argentina.
My question is how do I make the directional arrows works in a program built in Borland C.
Many thanks for your help
P.D: If anyone knows, please, write a simple code working
Welcome to Cprogramming.com.
If you're prepared to use the Win API, arrow keys can be coded by handling the WM_KEYDOWN message and checking wparam for the virtual key codes
However, it's likely that you're programming simple console apps. If you'd like an example using Windows, though, I can attach one to this thread.
And, of course, there's the FAQ on this site.
Away.
The arrows use a 2-byte character, \0 followed by a letter.Originally posted by Ian Paice
Hello, greetings from Argentina.
My question is how do I make the directional arrows works in a program built in Borland C.
Many thanks for your help
P.D: If anyone knows, please, write a simple code working
To check what keys are what characters (and a way to read them) try this:
From there, do what you need. with gotoxy() and other console io routines.Code:#include <stdio.h> #include <conio.h> /* needed for kbhit and getch */ #include <ctype.h> /* needed for isprint */ int main() { int ch; ch = -1; while (ch != 0x1B) /* watch for an ESC */ if (kbhit()) { ch = getch(); printf("%02X", ch); if (isprint(ch)) printf("/%c", ch); if (ch == 0) { ch = getch(); printf(" %02X", ch); if (isprint(ch)) printf("/%c", ch); } printf("\n"); } return 0; }
Definition: Politics -- Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
hello Ian Paice.. welcome to cprogramming.com good to have new members...
I suggest that you search the board first before posting because most of the questions have already been discussed in lengths.. like the direction key etc etc..
Well any way.. no problem.. the same thing happened to me at the begining...
Welcome again..
>P.D: If anyone knows, please, write a simple code working
It's a good idea to search the FAQ and then the boards just in case somebody *wink wink* already supplied the answer with loving attention to detail(1).
(1) Either that, or threw together whatever she could in the 5 minutes it took to nuke her dinner. But I'm not telling which.
My best code is written with the delete key.