FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
drv_intl_getmonthname.c
Go to the documentation of this file.
1
/* get localized month name */
2
3
#include "../fb.h"
4
#include "
fb_private_intl.h
"
5
6
FBSTRING
*
fb_DrvIntlGetMonthName
(
int
month,
int
short_names )
7
{
8
char
*pszName =
NULL
;
9
size_t
name_len;
10
LCTYPE lctype;
11
FBSTRING
*result;
12
13
if
( month < 1 || month > 12 )
14
return
NULL
;
15
16
if
( short_names ) {
17
lctype = (LCTYPE) (LOCALE_SABBREVMONTHNAME1 + month - 1);
18
}
else
{
19
lctype = (LCTYPE) (LOCALE_SMONTHNAME1 + month - 1);
20
}
21
22
pszName =
fb_hGetLocaleInfo
( LOCALE_USER_DEFAULT, lctype,
23
NULL
, 0 );
24
if
( pszName==
NULL
) {
25
return
NULL
;
26
}
27
28
name_len = strlen(pszName);
29
30
result =
fb_hStrAllocTemp
(
NULL
, name_len );
31
if
( result!=
NULL
) {
32
/* !!!FIXME!!! GetCodepage() should become a hook function for console and gfx modes */
33
int
target_cp =
/*( FB_GFX_ACTIVE() ? FB_GFX_GET_CODEPAGE() : GetConsoleCP() );*/
GetConsoleCP();
34
if
( target_cp!=-1 ) {
35
FB_MEMCPY
( result->
data
, pszName, name_len + 1 );
36
result =
fb_hIntlConvertString
( result,
37
CP_ACP,
38
target_cp );
39
}
40
}
41
42
free( pszName );
43
44
return
result;
45
}
rtlib
win32
drv_intl_getmonthname.c
Generated on Thu Jan 23 2014 19:40:08 for FreeBASIC by
1.8.4