c++ - Arguments parsing error -


i trying parse run-arguments within console application code:

int _tmain(int argc, _tchar* argv[]) {     if(argv[1] == _t("arg1")) cout<<"argument1 passed";     _getch();     return 0;  } 

my code doesn't work. mean, runs, console empty. compiling use unicode character set option in visual studio 2012 (on windows 7). mistake?!

use strcmp compare char arrays

if(strcmp(argv[1], "arg1") == 0) 

use of == compares pointers 2 different strings.

see darius kucinskas' answer comparing _tchar arrays


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -