Mercurial > projects > hoofbaby
comparison deps/Platinum/ThirdParty/Neptune/Source/System/WinCE/NptWinceMain.cpp @ 0:3425707ddbf6
Initial import (hopefully this mercurial stuff works...)
author | fraserofthenight |
---|---|
date | Mon, 06 Jul 2009 08:06:28 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3425707ddbf6 |
---|---|
1 /***************************************************************** | |
2 | | |
3 | Neptune - Utils : WinCE Implementation | |
4 | | |
5 | (c) 2002-2006 Gilles Boccon-Gibod | |
6 | Author: Gilles Boccon-Gibod (bok@bok.net) | |
7 | | |
8 ****************************************************************/ | |
9 | |
10 /*---------------------------------------------------------------------- | |
11 | includes | |
12 +---------------------------------------------------------------------*/ | |
13 #include <windows.h> | |
14 | |
15 /*---------------------------------------------------------------------- | |
16 | _tmain | |
17 +---------------------------------------------------------------------*/ | |
18 extern int main(int argc, char** argv); | |
19 | |
20 int | |
21 _tmain(int argc, wchar_t** argv, wchar_t** envp) | |
22 { | |
23 char** argv_utf8 = new char*[1+argc]; | |
24 int i; | |
25 int result; | |
26 | |
27 // allocate and convert args | |
28 for (i=0; i<argc; i++) { | |
29 unsigned int arg_length = wcslen(argv[i]); | |
30 argv_utf8[i] = new char[4*arg_length+1]; | |
31 WideCharToMultiByte(CP_UTF8, 0, argv[i], -1, argv_utf8[i], 4*arg_length+1, 0, 0); | |
32 } | |
33 | |
34 // terminate the array | |
35 argv_utf8[argc] = NULL; | |
36 | |
37 // call the real main | |
38 result = main(argc, argv_utf8); | |
39 | |
40 // cleanup | |
41 for (i=0; i<argc; i++) { | |
42 delete [] argv_utf8[i]; | |
43 } | |
44 delete[] argv_utf8; | |
45 | |
46 return result; | |
47 } |