Refer:
Http://stackoverflow.com/questions/895827/what-is-the-difference-between-tmain-and-main-in-c
Http://msdn.microsoft.com/en-US/library/fzc2cy7w (V = vs.80). aspx
On the Win32 ConsoleProgramUnder development,
Visual c ++ extends the Standard C ++ main function, defines the wmain entry, and adds the wchar_t keyword to support Unicode (UTF-16) characters.
(Correspondingly, the original ASCII string functions have corresponding _ wxxx, _ TXXX series functions)
At the same time, _ tmain is defined for flexible conversion between wmain and Main,
The _ tchar is defined for flexible conversion between wchar_t and char.
When _ Unicode is defined, wmain and wchar_t are used; otherwise, main and Char are used.
In Visual Studio 2010, enable and disable _ Unicode as follows:
Enter project properties,
In the tree menu on the left, choose configuration properties-> General
Under project defaults on the right, the character set option is set to not set or Unicode.
In Unicode, an '\ 0' byte is added before ASCII,
In this way, in x86 systems, only the first ASCII character is output if Unicode characters are Output Using cout due to the use of small-end notation.
That is:
Wchar_t * WCHR = l "ABC"; cout <(char *) WCHR <Endl; wcout <WCHR <Endl;
Output:
AABC