| | |
How do I retain output window in Dev-C++
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
You may want to have a look here http://www.daniweb.com/forums/thread90228.html.
Here's a snippet you can include at the end of main(), just prior to the return statement.
or, if that doesn't work, pressing ENTER and nothing seems to happen, which is most likely due to the fact that
I'm still learning this stuff and most likely other more experienced forum members could better explain things. From my experience, reading up on
And that's it, my first bit of advice, hope I'm on the mark.
Here's a snippet you can include at the end of main(), just prior to the return statement.
cpp Syntax (Toggle Plain Text)
// exit routine cout << "\n\n...Press ENTER to Exit System..."; cin.get();
cin refuses to accept any more characters due to it being in an error state and that error needs to be erased or cleared out; try this cpp Syntax (Toggle Plain Text)
cout << "...Press ENTER to Exit System..."; cin.clear(); while (cin.get() != '\n') ; cin.get();
cin and understanding why errors may occur (ie. assigning alphbetical characters to a numerical variable) will dictate what method you use.And that's it, my first bit of advice, hope I'm on the mark.
You are relying upon that program (pause.exe) being available and in that particular context it's only applicable or valid for Windows. I wrote a quick 'hello world' in Linux, it compiled ok, with system("pause") but on running it this is the output:
If you do away with
I'll re-state, I'm still learning this stuff and more experienced members might explain it better.
•
•
•
•
>./test
sh: pause: not found
Hello World
system("pause") then you can easily transfer your code and compile under other operating systems without having to make any modifications. I'll re-state, I'm still learning this stuff and more experienced members might explain it better.
i dont know this is correct or not but is there anything like this..
that when we use
this way the system will be able to do other processes too...it is kind of simulating many processes efficiectly making use of system's time..
@experts..
plz check is it correct or i m wrong about it..
that when we use
system("pause"); then the system remains in the wait state and is not free for any other process...but if we use cin.get(); then the system will do other processes too and will keep on checking the input stream (for any input entered by the user) after each instruction cycle of it's process...this way the system will be able to do other processes too...it is kind of simulating many processes efficiectly making use of system's time..
@experts..
plz check is it correct or i m wrong about it..
Life is about being happy...
Last edited by Ancient Dragon; Dec 20th, 2007 at 6:57 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
>You are relying upon that program (pause.exe) being available
You're also relying on that program doing what you expect it to do. The problem is that one can easily replace pause.exe with another program of the same name but a malicious payload.
>But when I choose simply to run again, after having compiled
>and run. The output window only flashes briefly again.
That sounds like an order of operations thing, though it's hard to say without knowing what compiler you use.
You may be running an old version of the program that didn't have a pause at the end. Always compile before you run the program to avoid this problem.
You're also relying on that program doing what you expect it to do. The problem is that one can easily replace pause.exe with another program of the same name but a malicious payload.
system("pause"); isn't portable, but the real kicker is that it's a huge security hole.>But when I choose simply to run again, after having compiled
>and run. The output window only flashes briefly again.
That sounds like an order of operations thing, though it's hard to say without knowing what compiler you use.
I'm here to prove you wrong.
![]() |
Other Threads in the C++ Forum
- Previous Thread: How to get adress of class function. (Function pointer)
- Next Thread: plz can help me in this q ??
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count data delete deploy desktop developer directshow dll download dynamic encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node number output parameter pointer problem program programming project proxy python read recursion recursive return string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






