Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8242701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:15:22+00:00 2026-06-07T21:15:22+00:00

I am having some real trouble around here giving command line arguments to Visual

  • 0

I am having some real trouble around here giving command line arguments to Visual Studio in the project options itself (in ‘Configuration Properties’ -> ‘Debugging’).

I wrote this “int main(int argc)” after the “int main(int main_i)” did not work. In the MS visual studio property pages’ Command line argument for the project I am not sure what I should write. I only want to pass a single integer to designate whether a file is to read or written to thus a mere int argc. I do not need the char *argv[]. I have tried a few values in the command line argument text box but it is not reaching the exe file when it executes, it shows what I did not enter at all.

Could you just provide me with a single simple example of what I need to enter in the MSVS C++ Property Pages’ Command Line Argument space? I simply can’t find any example on how to give the command line arguments to MSVS.

I also do not understand WHY I need to rebuild the whole project even when I just modified the command line argument value only??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:15:23+00:00Added an answer on June 7, 2026 at 9:15 pm

    If you want your program to understand a single integer command line argument, you still have to use argc and argv. Something like this ought to do it:

    int main(int argc, char *argv[]) {
    
        if (argc < 2) {
            fprintf(stderr, "Need a command line argument.\n");
            exit(1);
        }
    
        int arg = atoi(argv[1]);
        // now you have an integer
        // do whatever with it...
    }
    

    The C standard requires that the main function have specific sets of parameters. One of the allowed combinations is (int, char *[]). You can name the parameters whatever you want, but they’re almost always called argc and argv.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having real trouble trying to deserialize some XML and was hoping someone
I'm having real trouble getting my head around this issue. As the title suggests,
Ok.. having some real trouble putting two SWF videos into a website for my
I have been having some real trouble with this for a while. I am
Probably something really simple, but I'm having some real trouble with it. I have
I'm having some real trouble with timing a function from within an instance of
I am having some real trouble with this, below is the code, I am
First time cake user and I'm having real apache problems. For some reason the
Having some issues getting my head around the differences between UTF-8, UTF-16, ASCII and
Having some trouble with what should be a very simple scenario. For example purposes,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.