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?
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?
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.
"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
The difference between
main
andwmain
is the type used to represent the arguments to the program. Themain
function uses normalchar
whilewmain
useswchar_t
which can accept unicode values