getch() equivalent for Dev C++

This is a discussion on getch() equivalent for Dev C++ within the C++ Programming forums, part of the General Programming Boards category; are there any or am i really limited to using cin?...

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

    getch() equivalent for Dev C++

    are there any or am i really limited to using cin?

  2. #2
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    Code:
    #include <stdlib.h>
    
    ...
    .........
    
    system("pause");
    
    ....
    or cin.get();


    do a search

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    2

    How about...

    Instead of finding a function that works with your compiler you should get a compiler that works with all the functions you want to use. You would be supprised how many functions will not work with DevC++. There are many compilers that will work with a nice development environment. Now matter which free compiler you choose cEdit ( http://cedit.sourceforge.net ) will work well and I think it is actually nicer than DevC++'s environment. My prefered free compiler is Borland ( http://www.borland.com ). There is always the more expensive but versitile Visual Studio by Microsoft.
    Last edited by Squiggle; 04-24-2003 at 03:20 PM.

  4. #4
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    i dont need it for a system pause
    i need it to actually wait for a specific keyboard input before proceeding, and without using enter

  5. #5
    Open to suggestions Brighteyes's Avatar
    Join Date
    Mar 2003
    Posts
    204
    getch doesn't exist with DevC++, but getche does:
    Code:
    #include <iostream>
    #include <conio.h>
    
    using namespace std;
    
    int main()
    {
        cout<<"Hit a key: ";
        
        int key = getche();
        
        cout<<"\nYou hit "<< static_cast<char>(key) <<endl;
        
        cin.get();
    }
    p.s. What the alphabet would look like without q and r.

  6. #6
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    Theres been tons of topics on these boards about incorporating getch() into dev, just run a search theres lots of information.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. getch() equivalent in C++
    By hauzer in forum C++ Programming
    Replies: 3
    Last Post: 06-02-2009, 06:54 PM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 02:01 AM
  3. kbhit() and getch() Equivalent..
    By ThLstN in forum C Programming
    Replies: 1
    Last Post: 03-11-2008, 03:44 AM
  4. Pls repair my basketball program
    By death_messiah12 in forum C++ Programming
    Replies: 10
    Last Post: 12-11-2006, 05:15 AM
  5. Replies: 0
    Last Post: 11-01-2002, 11:56 AM

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