(c program)ARRROW key don't in borland turbo c++ 4.5

This is a discussion on (c program)ARRROW key don't in borland turbo c++ 4.5 within the C Programming forums, part of the General Programming Boards category; hello, i have a very strange problem. i wrote a program in " c " in " borland turbo c++ ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    5

    Question (c program)ARRROW key don't in borland turbo c++ 4.5

    hello,
    i have a very strange problem.
    i wrote a program in "c" in "borland turbo c++ 3.00" "dos version" that uses the ARROW keys.
    ARROW KEYS works great in this program, and my program is completely ok in "turbo c++ 3"
    but when i copy and paste this program, to "borland turbo c++ 4.5" windows version, ARROW keys don't work on it.there isn't even a single error or warning message.
    i am sure this is a problem in borland turbo c++ 4.5.
    but i wrote this program for one of my friends and she needs it to work on borland turbo c++ 4.5.
    could any one please help to solve this problem.
    thanks in advance.

  2. #2
    Epy
    Epy is offline
    Fortran lover Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    995
    I'm guessing your program uses the DOS-specific conio.h header, so it probably isn't going to work on Windows, at least not modern versions of Windows

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,007
    Don't use outdated software. Get modern.
    http://cpwiki.sf.net/IDE
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    Dec 2010
    Posts
    5

    Unhappy

    ya, that's right , my program uses the "conio.h".
    , and as i told it is a project that my friend needs to work in borland turbo c++ 4.5.
    she must give this project in class using borland c++ 4.5.
    so isn't there really a solution to this problem?
    i mean can't we use arrow keys in borland turbo c++ 4.5 , in any way?
    Last edited by massiha; 12-19-2010 at 08:28 AM. Reason: adding more info

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    What headers are you using?

    I'm not familiar with 4.5, but it sounds like you may need to use the Windows way of getting key strokes, instead of the DOS way. MS library has examples of it, but it's nowhere near as easy to work with, imo.

    I believe this is right, (from an earlier post on the board):
    Code:
    while(1)
    {
        if(GetKeyState(VK_UP) & 0x80)
        {
            // up arrow being pressed
        }
            
        // continue looping regardless, without waiting for any input.
    }
    You need to include windows.h, of course, unless it's already done for you on 4.5

    MS library has more, check for GetKeyState() or Virtual Keyboard
    Last edited by Adak; 12-19-2010 at 09:28 AM.

  6. #6
    Registered User
    Join Date
    Dec 2010
    Posts
    5
    hi ,adak
    i can't understand the code you wrote.
    could you please write a small example program
    that if the key was "up arrow" or any other just printf something?
    thanks.

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by massiha View Post
    hi ,adak
    i can't understand the code you wrote.
    could you please write a small example program
    that if the key was "up arrow" or any other just printf something?
    thanks.
    I can't do that. I'm using Turbo C ver. 1.01,and it doesn't have the windows.h include file that this program needs.

    Go to either Google or MS library, and search for "GetKeyState" or "Virtual Keyboard". What they've done is assign values to the key, similar to, but different than, the old key scan codes. They have a sample program in the MS library.

  8. #8
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by massiha View Post
    hello,
    i have a very strange problem.
    i wrote a program in "c" in "borland turbo c++ 3.00" "dos version" that uses the ARROW keys.
    ARROW KEYS works great in this program, and my program is completely ok in "turbo c++ 3"
    but when i copy and paste this program, to "borland turbo c++ 4.5" windows version, ARROW keys don't work on it.there isn't even a single error or warning message.
    i am sure this is a problem in borland turbo c++ 4.5.
    but i wrote this program for one of my friends and she needs it to work on borland turbo c++ 4.5.
    could any one please help to solve this problem.
    thanks in advance.
    WOW... I'm with Elysia on this one... You need to get your compiler out of the 16 bit stone age...

    I would recommend PellesC ... smorgasbordet - Pelles C

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,823
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 05:42 PM
  4. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 05:42 PM

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