![]() | ![]() |
|
Welcome to the HEXUS.community discussion forums forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and other features. By joining our free community you will have access to post topics, respond to polls and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! |
|
|||||||
Networking and Broadband ADSL, cable, internet and network advice and chat ![]() |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Weee, I gots an avatar
Join Date: Oct 2005
Location: South Wales
Posts: 934
Thanks: 0
Thanked 0 Times in 0 Posts
|
keeping the console window open to see your program
Sorry for the title, was hard to explain my question in a title. Its prob not even the right forum to put it in :S
Im learnign c++, and when you start you make simple programs that run in a console window, but when you run the program if its something simple like for example, the "Hello World!" you don't see it because obviously the computer does it so fast when it gets to the program it closes. You can obviously put another std::cin at the end so the program needs something entered before it ends but none of the tutorials have this and they never say anything about the console closing. So is there a setting or somthing for command promt i can change for it to stay open after a program is run? Cheers. |
|
|
|
|
|
#5 (permalink) |
|
Gentoo Ricer
Join Date: Jan 2005
Location: /var/portage
Posts: 4,259
Thanks: 19
Thanked 107 Times in 102 Posts
|
Code:
char quit;
while (quit != 'q') {
quit << cin;
}
return 0;
Main Rig -> J&W RS780UVD-AM2+ | AMD X4 9750 | 4x2GB GieL PC2-6400 | 2x500GB (md-raid0) | Sapphire HD4870 | Gentoo (AMD64) Server Box -> Asus P5B-E Plus | C2D E6320 | 2x1GB OCZ PC2-8500 | 4x500GB (md-raid5) | BFG 8800GTS 320Mb | Gentoo (Hardened/AMD64) Test Box -> P4E 3.2Ghz Rev. E0 | Asus P4C800-E Deluxe | 2x1GB PC3200 | 1x500Gb | NVidia TNT 2 | Gentoo (X86) Currently breaking: eINIT
|
|
|
|
|
|
#6 (permalink) |
|
Weee, I gots an avatar
Join Date: Oct 2005
Location: South Wales
Posts: 934
Thanks: 0
Thanked 0 Times in 0 Posts
|
So why don't books/tutorials, esp ones that know your running your first progs in cmd tell you that it will close before you even see it run?
std::cout << "ta for all the help."; |
|
|
|
|
|
#7 (permalink) |
|
Gentoo Ricer
Join Date: Jan 2005
Location: /var/portage
Posts: 4,259
Thanks: 19
Thanked 107 Times in 102 Posts
|
Technically it doesn't, ANSI/ISO C++ expects you to have a terminal open already, i.e. start->run, type "cmd" enter, and run it there. Windows (and other DEs) close the terminal windows after main() returns, if it opened the terminal, whether the return value be a zero or non-zero value. So it's pretty much a Windows cravet with commandline software.
And most welcome
Main Rig -> J&W RS780UVD-AM2+ | AMD X4 9750 | 4x2GB GieL PC2-6400 | 2x500GB (md-raid0) | Sapphire HD4870 | Gentoo (AMD64) Server Box -> Asus P5B-E Plus | C2D E6320 | 2x1GB OCZ PC2-8500 | 4x500GB (md-raid5) | BFG 8800GTS 320Mb | Gentoo (Hardened/AMD64) Test Box -> P4E 3.2Ghz Rev. E0 | Asus P4C800-E Deluxe | 2x1GB PC3200 | 1x500Gb | NVidia TNT 2 | Gentoo (X86) Currently breaking: eINIT
Last edited by aidanjt; 28-06-2006 at 11:40 PM.. |
|
|
|
![]() |
| Breadcrumb | ||||||
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do I restore "Show Desktop" icon in the Quick Launch bar of Windows? | davidstone28 | Help - technical & advisory | 7 | 09-01-2006 12:02 PM |
| Window Tints - New Legislation Planned | Barakka | HEXUS.automotive - Cars & Bikes | 14 | 05-05-2005 02:32 PM |
| Recovery console "access denied" Help | iranu | Operating systems & applications | 0 | 20-01-2005 11:25 AM |
| Open Source Articles | r1zeek | General discussion | 6 | 13-08-2004 08:14 AM |