How to write text to command prompt console windows?

S

Steven

I am using VC++ 6.0 to build a windows based application, however, my
application allows user to input command arguments in the dos prompt
windows. I want to have a warning message for user if they have input the
wrong arguments. How can I write text to the dos prompt windows if user
input the wrong arguments?

Thanks in advance.

Steven.
 
G

Guest

I am using VC++ 6.0 to build a windows based application, however, my
application allows user to input command arguments in the dos prompt
windows. I want to have a warning message for user if they have input the
wrong arguments. How can I write text to the dos prompt windows if user
input the wrong arguments?

When your app starts, validate the arguments in the argument list (called
argv typically)
If the arguments are OK, proceed with your app. If they aren't, print an
appropriate message to the console, with printf, fprints, or cout.
 
S

Steve Alpert

Bruno said:
When your app starts, validate the arguments in the argument list (called
argv typically)
If the arguments are OK, proceed with your app. If they aren't, print an
appropriate message to the console, with printf, fprints, or cout.

OTOH, if they start the application with an icon (and there isn't a DOS command
window) you have to reflect the error in a messagebox anyway so why not just do
it that way for both cases?

/steveA
 
C

Code Jockey

Use AllocConsole() to attach the stdin, stdout, stderr handles so that
printf(), fprintf(stderr,...) etc. will show up for gui apps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top