How do I set the command line arguments for a console application I am debugging in Visual Studio? I've done this in Eclipse, is there a similar option in Visual Studio?
They are parameters/arguments supplied to the program when it is invoked. They are used to control program from outside instead of hard coding those values inside the code. argv[argc] is a NULL pointer. argv[0] holds the name of the program.
Command Line Arguments
can be set in the Debug
tag in the project's Properties
window:
Alternatively, there is an option to add StartArguments
element to your .csproj.user
file:
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <PublishUrlHistory /> <InstallUrlHistory /> <SupportUrlHistory /> <UpdateUrlHistory /> <BootstrapperUrlHistory /> <ErrorReportUrlHistory /> <FallbackCulture>en-US</FallbackCulture> <VerifyUploadedFiles>false</VerifyUploadedFiles> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <StartArguments>Argument1 Argument2</StartArguments> <<== THIS LINE </PropertyGroup> </Project>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With