Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3046

How to access argv strings?

$
0
0
I have:

int _tmain(int argc, char* argv[])
{
printf("drive name: %s\n", argv[1]);

It displays only the first character of the first argument on the command line.

Yet the following works as expected:

static char* myArg[2] = {"first arg","second arg"};
printf("drive name: %s\n", myArgv[1]);

That displays the entire string "second arg".

So what's wrong with my reference to argv[1]?

Viewing all articles
Browse latest Browse all 3046

Trending Articles