Thread: help with Dev-C++

  1. #1
    Registered User Mustang5670's Avatar
    Join Date
    Dec 2003
    Posts
    53

    help with Dev-C++

    OK, I'm writing a program and im using a for loop. when i run the program i have to strike a key then hit enter. I used to just press a key and then the program would move on, with out displaying the key that i typed. But for some reason its wanted me to press the enter key now. Wierd. Is it something to do with Dev-C++ ?

    Code:
    #include <stdio.h>
    #include <conio.h>
    
    int main()
    {
      char c;
    
      for( ;; )
      {
              c = getch();
              if(c=='w')
             {
                  break;
             }
       }
    }
    Any suggestions.
    Last edited by Mustang5670; 01-04-2004 at 10:24 PM.
    Which 'a Huh?

  2. #2
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218

    hmm...

    Dev-C++ wouldn't be the reason. Are you using a different OS now?

    Dev-C++ has stdio.h, which just lists the arguments for functions compiled in the OS. Changing compiler's shouldn't change anything.

    Which compiler did you use last?

    EDIT:
    Why do you need conio.h 0_o?

  3. #3
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218

    Another suggestion

    make c an int instead of a char.

  4. #4
    Registered User Mustang5670's Avatar
    Join Date
    Dec 2003
    Posts
    53
    I first used DJGPP and the program worked fine. Now that I used Dev-C++ the program runs alittle off. I might just have to recompile with DJGPP and see if that works.

    I need conio.h for the getch() function
    Which 'a Huh?

  5. #5
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218
    getch() is in stdio.h! you DON'T need conio!

    DJGPP and Dev-C++ use the same compiler - GCC

  6. #6
    Registered User Mustang5670's Avatar
    Join Date
    Dec 2003
    Posts
    53
    changing c to an int from a char does not change anything
    Which 'a Huh?

  7. #7
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218

    hm...

    when I compile it, I don't need to press enter :/

    put a 'return 0;' at the end too.

  8. #8
    Registered User Mustang5670's Avatar
    Join Date
    Dec 2003
    Posts
    53
    man, thats wierd..I just started fresh with the dev-c and it still wants me to press enter..this is driving me nuts.

    oh well, thanks for your help
    Which 'a Huh?

  9. #9
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218
    even when I compile it in Dev-C++, it works the way you want! What version are you using?

  10. #10
    Registered User Mustang5670's Avatar
    Join Date
    Dec 2003
    Posts
    53
    lol i'm cursed or something. That's just my luck

    I'm using Dev-C++ version 4, cause i didn't want the beta version.
    Which 'a Huh?

  11. #11
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218
    get the beta. it works fine (in fact, better!).

    be sure to Uninstall the old version before u install the new one.

  12. #12
    Registered User Mustang5670's Avatar
    Join Date
    Dec 2003
    Posts
    53
    I think I may. when I un-install it. will my programs i've written that i have in the bin be deleted or no?

    most of all I have to get this enter crap fixed first. then I will get the new version.. *sigh* its going to take me all night to figure it out.
    Which 'a Huh?

  13. #13
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by kinghajj
    getch() is in stdio.h! you DON'T need conio!

    DJGPP and Dev-C++ use the same compiler - GCC
    getch() is not a standard function and isn't guaranteed to be in the same place across different compilers. For Windows based libraries, conio.h is a common place to store it.

    According to the delorie web site:
    http://www.delorie.com/djgpp/doc/lib...58.html#SEC358
    Code:
    Syntax
    
    #include <conio.h>
    
    int     getch(void);
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  14. #14
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218
    it should only erase the files installed, not others put by the user.

    And, the beta installs in C:\Dev-Cpp instead of C:\Dev-C++

  15. #15
    Registered User Mustang5670's Avatar
    Join Date
    Dec 2003
    Posts
    53
    ah, thanks for all the help.

    *super man theme *
    !!!with booming voice!!!

    "I'm off to fix the enter thingy"
    Which 'a Huh?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  2. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  3. openGL programming - From MSVC++ to Dev C++
    By WDT in forum Game Programming
    Replies: 3
    Last Post: 03-08-2004, 08:47 PM
  4. openGL programming - From MSVC++ to Dev C++
    By WDT in forum Game Programming
    Replies: 1
    Last Post: 03-08-2004, 05:19 PM
  5. DEV C++ Limitations?
    By Kirdra in forum Game Programming
    Replies: 3
    Last Post: 09-09-2002, 09:40 PM