Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem w/ input/output from DOS box command line 2

Status
Not open for further replies.

TimmerM

Programmer
Jul 1, 2001
1
US
Hello,
Does anyone know how to get Visual C++ 6.0 to compile, link, and run a straight C++ program that runs from the command line? When I try to run a simple C++ program using WinMain(), I can't get input from or output to a DOS box using cout, cin, printf and scanf. From what I've been able to gather, when linked with the QuickWin library these input/output functions are assigned to special windows because they are connected to the predefined files stdin, stdout and stderr.
However, when I try to comment out including 'windows.h' I get errors, whether I try to use WinMain() or main().
Help! I just want a simple C++ program that runs from a DOS box and does input and output from the DOS box!
Thanks,
Tim
 
make a Win32 consolle application and use main. John Fill
1c.bmp


ivfmd@mail.md
 
I assume you know this but I will post it just in case

your main should look like this

int main(int argc, char* argv[])
{
// argc will tell you the number of words on the
// command line seperated by spaces so the first
// word WILL be the name of the executable
// argv will range from 0 thru argc -1 where
// argv[0] = executable name
// argv[1] = 1st command line arg
// etc

return 0;
}

matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top