淺析_tmain()與main()的區(qū)別
有這么兩行
#include <stdio.h>
#include <tchar.h>
我們可以在頭文件<tchar.h>里找到_tmain的宏定義
#define _tmain main
所以,經(jīng)過(guò)預(yù)編譯以后, _tmain就變成main了
main()是標(biāo)準(zhǔn)C++的函數(shù)入口。標(biāo)準(zhǔn)C++的程序入口點(diǎn)函數(shù),默認(rèn)字符編碼格式ANSI
函數(shù)簽名為:
int main();
int main(int argc, char* argv[]);
_tmain()是windows提供的對(duì)unicode字符集和ANSI字符集進(jìn)行自動(dòng)轉(zhuǎn)換用的程序入口點(diǎn)函數(shù)。
函數(shù)簽名為:
int _tmain(int argc, TCHAR *argv[])
當(dāng)你程序當(dāng)前的字符集為unicode時(shí),int _tmain(int argc, TCHAR *argv[])會(huì)被翻譯成
int wmain(int argc, wchar_t *argv[])
當(dāng)你程序當(dāng)前的字符集為ANSI時(shí),int _tmain(int argc, TCHAR *argv[])會(huì)被翻譯成
int main(int argc, char *argv[])
相關(guān)文章
C語(yǔ)言實(shí)現(xiàn)猜數(shù)字小游戲
這篇文章主要介紹了C語(yǔ)言實(shí)現(xiàn)猜數(shù)字小游戲,附有詳細(xì)代碼,需要的小伙伴可以參考一下,希望對(duì)你的遼西有所幫助2021-10-10c++ vector模擬實(shí)現(xiàn)的全過(guò)程
這篇文章主要給大家介紹了關(guān)于c++ vector的模擬實(shí)現(xiàn)過(guò)程,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-04-04