Thread: Directional arrows

  1. #1
    Registered User
    Join Date
    Jul 2003
    Location
    '>  Sayreville, New JerseyStudent >¡  >¢ />¨ East Yorks, UKFreelance Web Developer >©  >ª  >«  >¬  >­
    Posts
    1

    Exclamation Directional arrows

    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

  2. #2
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916
    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.

  3. #3
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164

    Re: Directional arrows

    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
    The arrows use a 2-byte character, \0 followed by a letter.

    To check what keys are what characters (and a way to read them) try this:
    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;
    }
    From there, do what you need. with gotoxy() and other console io routines.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  4. #4
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    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..

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Directional arrows
    By Shogun in forum Linux Programming
    Replies: 12
    Last Post: 08-04-2003, 09:11 AM
  2. directional keys @ console
    By ipe in forum C Programming
    Replies: 1
    Last Post: 03-13-2003, 06:25 AM
  3. up, down, left, right arrows
    By revelation437 in forum C Programming
    Replies: 10
    Last Post: 12-12-2002, 09:38 AM
  4. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  5. Using Arrows in Win32 Console
    By GreenCherry in forum C++ Programming
    Replies: 2
    Last Post: 10-04-2002, 11:27 AM