I have a program that reads hard-coded file-path and I want to make it read file-path from command line instead. For that purpose I changed the code like this:
#
Because all attempts to print the argument I placed in my variable failed, here my 2 bytes for this question:
std::string dump_name;
(stuff..)
if(argc>2)
{
dump_name.assign(argv[2]);
fprintf(stdout, "ARGUMENT %s", dump_name.c_str());
}
Note the use of assign, and also the need for the c_str() function call.