Why gets address value when parsing main() arguments?
c++, command-line-arguments, program-entry-point
Solution
You need to use:
std::wcout<<argv[i];
I guess you have enabled Unicode enabled in your compilation and when you do so, `_TCHAR` is defined as `wchar_t` and hence you use the `std::wcout` version to output the wide char string.
If you do not have Unicode enabled in the build options then
std::cout<<argv[i];
would work just fine because then `_TCHAR` is defined as `char` and there is an overloaded version of `<<` operator which takes an `char` argument.
Problem
I am using Visual C++ with the following code: ``` int _tmain(int argc, _TCHAR* argv[]) { for (int i = 0; i < argc; ++i) { cout << argv[i] << endl; } getch(); return 0; } ``` The program named `MyProgram.exe`. Then I run the program by: MyProgram.exe hello world The program was supposed to print: ``` MyProgram.exe hello world ``` but it did not, it printed 3 lines of address values: ``` 005D1170 005D118C 005D1198 ``` Did I do something wrong?