Before entering the arguments, select “All Configurations” and “All Platforms” in Configuration and Platform dropdown lists (or select the settings to be debugged).
How do I set command line arguments for C++?
VS 16.9.4
Win7-64
Setting command line arguments in:
Debug->Debug Properties->Configuration->Debugging->Command Line Arguments
yield argc ==1, argv[0] == <path>file.exe
My command line arguments are not present. Is there any way to set up command line arguments so that during a debug session I get the arguments? I see from other posts that it is possible so I wonder what I am missing.
Developer technologies | Visual Studio | Debugging
Developer technologies | C++
2 answers
Sort by: Most helpful
-
-
RLWA32 49,536 Reputation points
2021-05-02T20:05:46.997+00:00 I think you have misunderstood the way command line arguments are passed. The argv array contains an entry for each command line parameter passed. Index 0 is the path to the executable. To obtain the remaining parameters you need to iterate through the array until you have referenced the number of parameters indicated by argc. Don't forget that the array indexes are zero based so the maximum valid index will be one less than the value of.argc.