What is the difference between wmain and main?

前端 未结 3 1120
南方客
南方客 2020-12-03 10:13

So I have some class starting with

#include 
#include 

and there is a wmain function .

相关标签:
3条回答
  • 2020-12-03 10:30

    "If your code adheres to the Unicode programming model, you can use the wide-character version of main, which is wmain."

    http://msdn.microsoft.com/en-us/library/aa299386%28VS.60%29.aspx

    main( int argc, char *argv[ ], char *envp[ ] )
    {
    program-statements
    }
    
    wmain( int argc, wchar_t *argv[ ], wchar_t *envp[ ] )
    {
    program-statements
    }
    
    0 讨论(0)
  • 2020-12-03 10:40

    main is the normal program entry point in c & c++ and is passed the command line in single byte characters. wmain is an alternative that is used in many windows programs for unicode programs where it instead gets passed the command line as wide 16 bit unicode characters.

    I believe it's a windows extension for unicode programs.

    0 讨论(0)
  • 2020-12-03 10:47

    The difference between main and wmain is the type used to represent the arguments to the program. The main function uses normal char while wmain uses wchar_t which can accept unicode values

    • http://msdn.microsoft.com/en-us/library/aa299386(VS.60).aspx
    0 讨论(0)
提交回复
热议问题