What is the difference between wmain and main?

Rella picture Rella · Mar 13, 2010 · Viewed 14.8k times · Source

So I have some class starting with

#include <wchar.h>
#include <stdlib.h>

and there is a wmain function .

How is it different from main function i usually use in my C/C++ programs?

Answer

Corey picture Corey · Mar 13, 2010

"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
}