Reputation: 1128
Suppose, that i have the code:
// My.cpp
#include <iostream>
int main( int argc, char ** argv )
{
if ( argc > 1 )
std::cout << argv[ 1 ] << std::endl;
}
( i use MVSC++ 2008 )
when i run my program in cmd.exe:
My.exe argument
i get this output :
a r g u m e n t
why?????
Upvotes: 2
Views: 375
Reputation: 109119
It looks like you're compiling with the Unicode character set option. Go to the project properties and under the General page change to "Use Multi-Byte Character Set". Alternately, if you want to use UTF-16 change the main()
function to:
int wmain( int argc, wchar_t **argv )
Also, use std::wcout
instead of std::cout
to print the arguments.
Upvotes: 1
Reputation: 1744
Might be a character code problem. Try replacing "std::endl" with "\n" and see. Also, are you compiling as Unicode?
Upvotes: 5