_tmain is a macro that expand to main o wmain according to _UNICODE macro. In
VC2005, By default , a program is unicode enabled (UNICODE and _UNICODE defined)
so your _tmain macro expands to wmain (not main) and _TCHAR expands to wchar_t.
The problem is that you are using 'cout' (which is prepared to work with
single wide strings) with a double wide string.
// This should work
#include <iostream>
#include <tchar.h>
#ifdef _UNICODE
#define _tcout wcout
#else
#define _tcout cout
#endif
using namespace std;
int _tmain(int argc, _TCHAR *argv[])
{
_tcout <<argv[0]<<endl;
return 0;
}
Regards
--
Cholo Lennon
Bs.As.
ARG
> //int _tmain(int argc, _TCHAR* argv[]) // main for windows
> int main(int argc, char *argv[]) // ... or main
[quoted text clipped - 14 lines]
>
> Tony
tonyjeffs2@googlemail.com - 16 Nov 2007 18:12 GMT
> _tmain is a macro that expand to main o wmain according to _UNICODE macro. In
> VC2005, By default , a program is unicode enabled (UNICODE and _UNICODE defined)
> so your _tmain macro expands to wmain (not main) and _TCHAR expands to wchar_t.
> The problem is that you are using 'cout' (which is prepared to work with
> single wide strings) with a double wide string.
<....>
Thank you - I understand that!
Tony