up, down, left, right arrows

This is a discussion on up, down, left, right arrows within the C Programming forums, part of the General Programming Boards category; so i have the ansi codes for the arrows the problem im running into is how do i use them ...

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    221

    up, down, left, right arrows

    so i have the ansi codes for the arrows
    the problem im running into is how do i use them in a C program?

    i need to read keyboard input for the arrow keys
    how do i do this?

  2. #2
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    do u use printf()s like u do with color?

  3. #3
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109

    Cool

    do u use printf()s like u do with color?
    fine lets ask questions and reply to our own questions

  4. #4
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    but is it correct?

  5. #5
    Me want cookie! Monster's Avatar
    Join Date
    Dec 2001
    Posts
    680

    Re: up, down, left, right arrows

    Originally posted by revelation437
    so i have the ansi codes for the arrows
    the problem im running into is how do i use them in a C program?

    i need to read keyboard input for the arrow keys
    how do i do this?
    What OS/Compiler do you use?

  6. #6
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    currently, im on windows 98 with borland 5.01
    alth0 for the finished product, i will be compiling the code on Borland Trubo C 3, since thats the only way i can get around the ANSI problem with windows 2k/xp

  7. #7
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    my problem is that, i can get the number arrow keys to work (by remapping them, basically, if there's a better way, lemme know!)
    but i cant get the regular arrow keys to work

  8. #8
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    arrow keys first sent a 0, then another number and 0 and other number is how the computer identifies that its an arrow key

    so once i read the 0, how do u bypass the 0 and get the next number so that i can get the actual arrow key?

  9. #9
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    figured it out
    hopefully
    what a fawkin headache

    time for some sleep, ill try to impliment the code later

  10. #10
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    the way i figured it out is
    after the 0
    RIGHT = M
    LEFT = K
    UP = H
    DOWN = P

  11. #11
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    actually, looking back on ur code
    i think its the same thing, except i dont see a reason why to add 256
    just check the next getch to see if its the values for those letters
    thanks for the help anyway

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Odd 3D Invis Objects?
    By Zeusbwr in forum Game Programming
    Replies: 4
    Last Post: 12-07-2004, 06:01 PM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  3. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 03:49 AM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  5. Please help me
    By teedee46 in forum C++ Programming
    Replies: 9
    Last Post: 05-06-2002, 11:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21