Hi
void BIG52GBK(char *szBuf)
{
if(!strcmp(szBuf, ""))
return;
int nStrLen = strlen(szBuf);
wchar_t *pws = new wchar_t[nStrLen + 1];
try
{
int nReturn = MultiByteToWideChar(950, 0, szBuf, nStrLen, pws, nStrLen + 1);
BOOL bValue = false;
nReturn = WideCharToMultiByte(936, 0, pws, nReturn, szBuf, nStrLen + 1, "?", &bValue);
szBuf[nReturn] = 0;
}
__finally
{
delete[] pws;
}
}
harbour request : HB_FUNC(BIG52GBK)
Regards
Shuming Wang
How to convert C++--> CPP ?
-
- Posts: 454
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Code: Select all
#include <hbapi.h>
#include <windows.h>
HB_FUNC( BIG52GBK )
{
char * szBuf = hb_parc( 1 );
int nStrLen = strlen( szBuf );
LPWSTR pws = ( LPWSTR ) hb_xgrab( ( sStrLen + 1 ) * 2 );
int nReturn = MultiByteToWideChar( 950, 0, szBuf, nStrLen, pws,
nStrLen + 1);
BOOL bValue = FALSE;
nReturn = WideCharToMultiByte( 936, 0, pws, nReturn, szBuf,
nStrLen + 1, "?", &bValue);
szBuf[ nReturn ] = 0;
hb_retclen( ( char * ) pws, nReturn );
hb_xfree( pws );
}
-
- Posts: 454
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China