VS not running WITH the "Command Arguments" I passed in. What am I not doing right?
Trying to work with "Command Arguments" in Visual Studio.
I broke it down to a simple little ConsoleApplication program in C.
#include "pch.h"
#include <iostream>
int main(int argc, char *argv[])
{
printf("\nargv: ");
for (int i = 0; i < argc; i++)
{
printf(" %s", argv[i]);
}
printf("\n");
}
I then set the "Command Arguments": Project: Properties: Debugging:"Command Arguments": mom
I hit the RUN button and this is displayed(my argument is not passed in):
argv: C:\Users\jack\source\repos\ConsoleApplication45\Debug\ConsoleApplication45.exe
C:\Users\jack\source\repos\ConsoleApplication45\Debug\ConsoleApplication45.exe (process 1812) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .
When I run from the command line I get (Works as I want it to with the parameter passed in: "mom"):
C:\Users\jack\source\repos\ConsoleApplication45\Debug>ConsoleApplication45.exe mom
argv: ConsoleApplication45.exe mom
C:\Users\jack\source\repos\ConsoleApplication45\Debug>
Thank you for the link Jean-François Fabre:
Yes I had to change to x64 from x86.