Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 22nd, 2007, 1:23 PM   #1
benders0
Newbie
 
Join Date: Jun 2007
Posts: 2
Rep Power: 0 benders0 is on a distinguished road
C++ in vista issue

I just installed vista yesterday and i use bloodshed compiler. Im doing standard iostream coding right now and the window wont stay open.

For example:

A simple hello world program wont stay open and a return value of 0 wont help, i dont know what to do.
benders0 is offline   Reply With Quote
Old Jun 22nd, 2007, 2:09 PM   #2
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 4 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
This has nothing to do with Vista. Include the <cstdlib> header and then append this line to your source.
system("PAUSE");
__________________
I would love to change the world, but they won't give me the source code!
ReggaetonKing is offline   Reply With Quote
Old Jun 22nd, 2007, 2:29 PM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
If you're concerned about portability, "system (PAUSE);" isn't. The perception that a window should remain open until it notices that the user has finished reading the screen is incorrect. It is one of the most commonly expressed "problems" on any forum. A previous answer from this forum:
Quote:
Programs run until they complete, then terminate. If you run your program from the command line, then the window belongs to command.exe. When your program completes, command.exe will put out another prompt in the same window. Your output will still be showing.

If you run your program in its own window (double-clicking its icon, say), then it will terminate and the window will close.

If the IDE (if you have one) provides the window, then IT will stay open, but if it spawns a window specifically for that execution, the window will close.

Note that the key word is "terminate". You may add an input statement to the end of your program so that it doesn't terminate until you provide it input. It'll sit there and wait for that, giving you plenty of time to look. You can use "cin.get ()."

You will need to clear the input before "cin.get ()" in case your user has pounded in some extraneous stuff. You can use cin.sync (), although there is some controversy regarding its standardized applicability to a basic_istream, or you may use cin.ignore (). See your documentation.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista Sound Driver Issues (Creative Cards) Ghost Coder's Corner Lounge 3 May 31st, 2007 3:36 PM
Vista prices leaked niteice Coder's Corner Lounge 27 Sep 1st, 2006 3:37 PM
Windows vista download!!, im doing it!!! hervens48 Coder's Corner Lounge 80 Jun 28th, 2006 7:02 PM
.NET, Vista and runtime. Booooze C# 4 Apr 25th, 2006 7:57 PM
Windows Vista, well sort of coldDeath Coder's Corner Lounge 21 Sep 6th, 2005 2:00 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:17 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC