1. What they have in common
int _tmain (int argc, _tchar* argv[]) and int main (int argc, char* argv[]) , both are the main functions of the program, both of which are the entrance to the program.
2. Differences between the two
Main () is the standard C + + function entry, the default character encoding format ANSI
The function name is:
int main ();
int main (int argc, char* argv[]);
_tmain () is a program entry point function that is provided for automatic conversion of the Unicode character set and the ANSI character set.
The function name is:
int _tmain (int argc, TCHAR *argv[]), when your program's current character set is Unicode, int _tmain (int argc, TCHAR *argv[]) is translated into int wmain (int argc, WCHA r_t *argv[]); When your program's current character set is ANSI, int _tmain (int argc, TCHAR *argv[]) is translated into int main (int argc, char *argv[])
_tmain This symbol is more common in VC + + created console project, this is to ensure that the migration of Unicode (General _t, _t, t () these things are related to Unicode), for the use of non-Unicode character set of the project, The actual main is no different (in fact, the use of the Unicode character set is not necessarily how much difference).
In addition , the definition of _tmain can be found in <tchar.h>, such as # define _tmain Main, so include # include <tchar.h>, and usually # include < Tchar.h> in # include "stdafx.h", so if you use int _tmain (int argc, TCHAR *argv[]) main function in the program, the header file will usually contain #include "stdafx.h" .
As for the character encoding format ANSI and Unicode have and differ from the following article:
About Main () and _tmain ()