Home  >  Q&A  >  body text

C++中wmain和main有什么区别与联系

C++中wmain和main有什么区别与联系,越详细越好,有底层分析最好了

高洛峰高洛峰2764 days ago584

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 14:50:02

    The command line parameter value argv passed in by the main function is an array of char , and the command line argv passed in by the wmain function is an array of wchar_t .
    In addition, Windows also has a _tmain, argv is an array of TCHAR *, and the first two will be selected according to whether to use Unicode according to the compilation settings.
    Generally, main is enough, because it is rare that there are Unicode characters to be processed in the command line. Even if you really want to deal with special characters such as Chinese, Windows also provides the GetCommandLine function to obtain the command line.

    reply
    0
  • Cancelreply