You have a few mistakes:
1) You cannot compare C-style strings (character arrays) using the == operator. argv[#]
is a character array, as is _T("some value")
. In order to compare them, you need to use strcmp
(or one of it's cousins), or store it in a std::string
.
2) You are attempting to access the 2nd element of the array, but only 1 element exists. you said you were passing nothing to the call, meaning argv[0]
will contain data (the name of the executable you are running), but argv[1]
will not. In general, attempting to access it will be attempting to access data outside the range of the array with undefined results. In this particular case, the standard (Section 3.6.2) states that it will always be 0 (aka NULL). So your conditional will always be false.
3) You should ALWAYS check the value of argc
when command line parameters are expected.