Computing.Net > Forums > Programming > C++ Programming

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C++ Programming

Reply to Message Icon

Name: HossTa
Date: November 12, 2004 at 05:07:55 Pacific
OS: Win2K
CPU/Ram: 2Gig/512MB
Comment:

How can we print the output of the program(which is in the black environment, dos form)in the c++ visual studio 6 compiler?




Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: November 12, 2004 at 10:11:15 Pacific
Reply:

When you create the project, select "Console Program" or something like that. Then when you run the program, the output will be in a DOS-type window.

But, once the program ends, the DOS-type window closes. So, you'll want to add something at the end of the program to cause the program to stop, and not end right away.
Most people add some type of char input statement to cause the program to wait for a character input before ending. Something like:

ch = getchar();


If you have a non-console project, I don't know if there is a way to get output to a console window.


0

Response Number 2
Name: InfiniteRecursion
Date: November 13, 2004 at 10:35:50 Pacific
Reply:

To pause the application before it closes...

#include <stdlib.h>

Then make a call to

system("PAUSE");


0

Response Number 3
Name: BlueRaja
Date: November 13, 2004 at 22:39:05 Pacific
Reply:

Most programmers prefer not to make system() calls (which would make Don's method the preferred one).

AKhalifman@hotmail.com


0

Response Number 4
Name: InfiniteRecursion
Date: November 29, 2004 at 21:36:12 Pacific
Reply:

Perhaps, back in the day when memory was expensive and hard drives were the size of our floppy disks... I could see a justified reason not to make system calls.

With today's technology, I do not see a reason to rule out a system call. It is strictly up to the programmer at what comes to mind first. Both methods work fine... its good to be flexible and to have alternatives.


0

Response Number 5
Name: BlueRaja
Date: November 30, 2004 at 01:28:13 Pacific
Reply:

I'd imagine it would have something to do with getting into the habit of making code easily transferrable to other Operating Systems (system() is OS specific, whereas getch() is not)
Not to say that all of us are going to transfer ALL of our code to Linux someday, but it doesn't hurt to get into these habits early (I always thought that I'd *never* need to program for Linux...yet, here I am, learning Linux programming in order to write and/or help write a module of Half-Life ^_^)

AKhalifman@hotmail.com


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C++ Programming

c++ programming for novell www.computing.net/answers/programming/c-programming-for-novell/2525.html

Bike Trader C program www.computing.net/answers/programming/bike-trader-c-program/6557.html

C++ Programming Website www.computing.net/answers/programming/c-programming-website/4752.html