SunQuest
           C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old May 7th, 2003, 12:43 AM
drvannostren drvannostren is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 3 drvannostren User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How can I test my C++ programs in XP

Hey, this might be an icredibly stupid question but that's just how dumb microsoft can be.

Windows XP contains no DOS, as far as I know, C++ program testing involves DOS. So correct me if I'm wrong, but this doesn't equate. Anyhow, when I compile my programs, in either Codewarrior, or Visual C++, the program opens (the DOS window pops up) then it closes before you get a chance to read anything. I know my program is working, but obviously I want to see my programs in action. How in the hell can I test them, i contacted microsoft, they don't know a damn thing.

Sidebar: If I'm right, and I'm not just doing something stupid, doesn't it seem retarded that Microsoft publishes a program that you can't even fully use?

Please respond asap, how can i dodge this? Or is there a complete fix? Or is there no way to test programs in XP? Thanks for the help.

Reply With Quote
  #2  
Old May 7th, 2003, 04:52 AM
TechNoFear TechNoFear is offline
Offensive Member
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2002
Location: in the perfect world
Posts: 594 TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level)TechNoFear User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 14 h 6 m 15 sec
Reputation Power: 21
>>Hey, this might be an icredibly stupid question but that's just how dumb microsoft can be.

Careful on who you call dumb at this point.

>>as far as I know, C++ program testing involves DOS

No.
WIN32 API apps (those designed to run on MS OS's) can be written in C or C++ ect. MFC is a wrapper written by MS for C++ and WIN32 API.


Your console app is executing and closing the console before you see the results.

Try adding a line at the end asking for a key press before exiting.

or use

sleep() to pause it
__________________
The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions.

Frank Zappa

Reply With Quote
  #3  
Old May 7th, 2003, 09:51 AM
drvannostren drvannostren is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 3 drvannostren User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Re:

Someone had told me that before. But it's got nothing to do with my programming, the code is fine. Any dos window in XP when started, starts up and then shuts down right away. It doesn't matter whether it's my programming, or a .bat isntaller that opens a dos windows and then closes it right away.

Reply With Quote
  #4  
Old May 7th, 2003, 10:12 AM
dwise1_aol's Avatar
dwise1_aol dwise1_aol is offline
Contributing User
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 3,803 dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)dwise1_aol User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Month 11 h 40 m 35 sec
Reputation Power: 437
Micro$oft keeps trying to bury it away deeper out of sight, but even XP, for all its Fisher-Price desktop, still has "DOS" (actually, a DOS emulation running in a "console").

I've only had to endure that OS at school (ironically, in a Linux class no less), but I think under "Programs | Accessories" you should find a "C:>" icon labeled "Command Prompt". Open that and cd to the directory your .EXE is in and run it from there. Problem solved.

BTW, when you cd under XP, you'll need to type the complete directory names -- no 8.3 abbreviations or wildcards allowed. Handle embedded spaces by putting quotation marks around the directory name; e.g., cd \"My Documents"

However, if you run it from the VC++ IDE, then the problem and solution are as TechNoFear told you. The IDE spawns a console shell which in turn runs your program. As soon as your program terminates, control passes back to the shell which also terminates, its job done. And the console closes before you have a chance to see what happened.

So to prevent your program from terminating immediately after producing the output you're interested in, you have to somehow prevent it from terminating immediately. TechNoFear's suggestions would do that.

Myself, I always run the program from a DOS window, so I never have that problem.

EDIT:
You might also want to read the "console app question" thread from 02 May, which discusses the same problem.

Last edited by dwise1_aol : May 7th, 2003 at 10:37 AM.

Reply With Quote
  #5  
Old May 7th, 2003, 06:18 PM
drvannostren drvannostren is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 3 drvannostren User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Re:

That's what I'm doing now, i'm trying to get around that though, because to simply test it and see how it's going i gotta shut down Codewarrior, then go through all that to test it, codewarrior would test it itself but cant. So i geuss imma have to stick with cmd prompt, even though its a pain in the arse.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > How can I test my C++ programs in XP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway