Passing command line arguments in Visual Studio 2010?

后端 未结 5 974
一个人的身影
一个人的身影 2020-11-27 02:49

I am working on a C project and can not figure out how to pass command line arguments to my main function in Visual Studio 2010 Express Edition. I want to debug - how do the

相关标签:
5条回答
  • 2020-11-27 03:25

    Visual Studio e.g. 2019 In general be aware that the selected Platform (e.g. x64) in the configuration Dialog is the the same as the Platform You intend to debug with! (see picture for explanation)

    Greetings mic enter image description here

    0 讨论(0)
  • 2020-11-27 03:26

    Under Project->Properties->Debug, you should see a box for Command line arguments (This is in C# 2010, but it should basically be the same place)

    0 讨论(0)
  • 2020-11-27 03:32

    Visual Studio 2015:

    Project => Your Application Properties. Each argument can be separated using space. If you have a space in between for the same argument, put double quotes as shown in the example below.

            static void Main(string[] args)
            {
                if(args == null || args.Length == 0)
                {
                    Console.WriteLine("Please specify arguments!");
                }
                else
                {
                    Console.WriteLine(args[0]);     // First
                    Console.WriteLine(args[1]);     // Second Argument
                }
            }
    
    0 讨论(0)
  • 2020-11-27 03:32
    1. Right click on Project Name.
    2. Select Properties and click.
    3. Then, select Debugging and provide your enough argument into Command Arguments box.

    Note:

    • Also, check Configuration type and Platform.

    After that, Click Apply and OK.

    0 讨论(0)
  • 2020-11-27 03:41
    • Right click your project in Solution Explorer and select Properties from the menu
    • Go to Configuration Properties -> Debugging
    • Set the Command Arguments in the property list.

    Adding Command Line Arguments

    0 讨论(0)
提交回复
热议问题