Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Blue*Omega

Visual C++ command line options

This topic is 6260 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay, I''ve been busting my brain trying to get this to work. I have a simple (dos) compression program that i have written and i want to add some command line options. Like so: Zipper -c test.zpp pic1.jpg pic2.jpg pic3.jpg Zipper is the program name, I want the -c to signal the progam to run the compile code (-e would be extract), the test.zpp the file i write to, and the rest to be the files I''m zipping. The thing I''m really stuck on is the -c though. How?!? I''m working in visual c++ 6.0; ----------------------------- Vash the Stampede "Love & Peace!"

Share this post


Link to post
Share on other sites
Advertisement
Your entry point probably looks something like this:
int main(int argc, char* argv[])
argc is the number of command line arguments (including the program's name), and argv is an array of the arguments themselves. So to see if the '-c' flag is present, you could do something like this:
    
int main(int argc, char* argv[])
{
if(argc == 1)
call_some_error_routine();


if(!strcmp(argv[1], "-c"))
do_compile_stuff();

else if(!strcmp(argv[1], "-e"))
do_extract_stuff();

...
}


~~~~~~~~~~
Martee

Edited by - Martee on June 24, 2001 10:14:44 PM

Share this post


Link to post
Share on other sites
For anyone reading this: Please NEVER refer to a feature of the C or C++ language as a feature of Visual C++. Microsoft does not have a monopoly on the functionality of C or C++. The features being asked about here were in existence before Microsoft existed.

Share this post


Link to post
Share on other sites
Thanks! I was trying:

if(strcmp(argv[0],"-c"))
{
compile();
}

BTW: I knew that this feature was in place before microsoft barged in. I just wondered if there might be a difference between it and other compilers (shouldn''t be...)

-----------------------------

Vash the Stampede

"Love & Peace!"

Share this post


Link to post
Share on other sites
quote:
Original post by bishop_pass
For anyone reading this: Please NEVER refer to a feature of the C or C++ language as a feature of Visual C++. Microsoft does not have a monopoly on the functionality of C or C++. The features being asked about here were in existence before Microsoft existed.

That''s exactly what I''m thinking anytime someone mentions "the next version of C++" or "learning Visual C++" .

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!