qse/qse/samples/cmn/main01.c

47 lines
808 B
C
Raw Normal View History

2012-01-03 14:41:15 +00:00
#include <qse/cmn/main.h>
#include <qse/cmn/mbwc.h>
#include <qse/cmn/stdio.h>
#include <locale.h>
#if defined(_WIN32)
# include <windows.h>
#endif
static int test_main (int argc, qse_char_t* argv[])
{
int i;
for (i = 0; i < argc; i++)
{
qse_printf (QSE_T("%d => [%s]\n"), i, argv[i]);
}
return 0;
}
int qse_main (int argc, qse_achar_t* argv[])
{
#if defined(_WIN32)
char locale[100];
UINT codepage = GetConsoleOutputCP();
if (codepage == CP_UTF8)
{
/*SetConsoleOUtputCP (CP_UTF8);*/
2012-10-15 09:36:39 +00:00
qse_setdflcmgrbyid (QSE_CMGR_UTF8);
2012-01-03 14:41:15 +00:00
}
else
{
sprintf (locale, ".%u", (unsigned int)codepage);
setlocale (LC_ALL, locale);
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
2012-01-03 14:41:15 +00:00
}
#else
setlocale (LC_ALL, "");
qse_setdflcmgrbyid (QSE_CMGR_SLMB);
2012-01-03 14:41:15 +00:00
#endif
return qse_runmain (argc, argv, test_main);
}