Thread: Dev- C++

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    58

    Dev- C++

    Hi all,

    Im having a bit of problem with Dev-C++. When i run a dos program i have to use the system("pause") command, to stop the dos screen flashing up fast and then vanishing - this was fine when my programs were simple. However now my programs are getting more complex( running command line applications), its getting a real pain using the pause command.

    Therefore could somebody offer me some advice on how to change the compilers configuration options to enable me not to use the system("pause") .

    Cheers

    Tuurbo46

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Just run your program from the command line. With the command prompt window open, you will not have this problem of "the dos screen flashing up fast and then vanishing".
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    58
    Hi,

    Thanks for speedy reply.

    Im dont really understand how to do that, currently i do the following:

    Open Dev-C++ >> open project >> run my program >> dos screen flashes up

    ????

    Look forward to your advice.

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    cin.get();
    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.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Im dont really understand how to do that, currently i do the following:

    Open Dev-C++ >> open project >> run my program >> dos screen flashes up
    1. Start -> Run -> Open cmd. The command prompt window appears.

    2. Using the command prompt, navigate to your project directory.
    For example,
    cd C:\projects\xyz

    3. Enter your program name at the command line to run the program.

    If you really do not want to run your program like this (or redirect output to a file), then you have no choice but to live with system("pause") or one of the better suggestions from our FAQ.

    Oh wait, our FAQ needs to be updated because Prelude pointed out that in.clear() is not guaranteed to work as expected. From what I see, you can just remove in.clear() from myflush() in the C++ example.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Quote Originally Posted by tuurb046 View Post
    Hi,

    Thanks for speedy reply.

    Im dont really understand how to do that, currently i do the following:

    Open Dev-C++ >> open project >> run my program >> dos screen flashes up

    ????

    Look forward to your advice.
    Select "Start" menu >> "Programs" >> "Accessories" >> "Command Prompt"

    In the black box that opens navigate to the directory where your exe is located using "cd" (change directory) command and type the name of your program to launch it.

    You can also create a shortcut to "Command Prompt" and configure it to start from desired directory.

    system("Pause") or cin.get are not very helpful if your program aborts because of an assert etc.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  7. #7
    Registered User
    Join Date
    Nov 2006
    Posts
    58
    Hi,

    Cheers for your help, i will have a go when i get home from work.

    Thanks

    Tuurbo46

  8. #8
    Registered User
    Join Date
    Nov 2006
    Posts
    58
    Hi again.

    I have followed your steps and i have a few questions:

    1) how to i create a shortcut to the path entered on the command line?

    2) is the path entered on the command line the same as creating a shortcut to the exe in the project folder (from windows desktop)?

    Cheers Tuurbo46

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Is there a reason you need to use Dev-C++?
    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.

  10. #10
    Registered User
    Join Date
    Nov 2006
    Posts
    58
    Hi,

    In a round about way, im a embedded c programmer and im learning dos c and c++ to improve my skill etc. After reading the cprogramming site they recommend Dev-C++ so this is what i use.

    Apart from the above reason no not really, what do you recommend?

    Cheers Tuurbo46

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    There's Visual Studio Express. Terrific IDE IMO.
    Last edited by Elysia; 12-05-2007 at 11:37 AM.
    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.

  12. #12
    Registered User
    Join Date
    Nov 2006
    Posts
    58
    hi,

    visual studio c++ 2008?

    http://msdn2.microsoft.com/en-us/exp.../bb421473.aspx

    Its funny you should say that im actually heading towards c++.net but did not realise you could run dos in this?

    Cheers

  13. #13
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    You mean CLI-type, no? A dos window within <insert favorite OS here>?
    Pretty much all compilers can do that.
    Yes, I mean 2008. It can do both C and C++, if you want.
    Btw, I meant IDE, not GUI. It's a dev environment, debugger and compiler.
    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.

  14. #14
    Registered User
    Join Date
    Nov 2006
    Posts
    58
    hi,

    yeah:

    printf("hello world"); // kinda link this

    Just practicing c and c++ in a dos enviroment before i get into windows.

    So downloading c++ from that link is ok?

    Thanks for all your help

    Tuurbo46

  15. #15
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Sure, Express is free, so go ahead if you want.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Whats better, C-Free or Dev C++??
    By i_can_do_this in forum Tech Board
    Replies: 10
    Last Post: 07-07-2006, 04:34 AM
  2. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  3. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  4. DEV C++ Limitations?
    By Kirdra in forum Game Programming
    Replies: 3
    Last Post: 09-09-2002, 09:40 PM
  5. Tutorial about Bloodshed Dev!
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 11-13-2001, 07:42 PM