char * WideCharToChar( char* pcstr,const wchar_t* pWstr,size_t nLen )
{
int nLength = wcslen( pWstr );
int nBytes = WideCharToMultiByte( 0,0,pWstr,nLength,NULL,0,NULL,NULL );
if ( nBytes > nLen )
{
nBytes = nLen;
}
WideCharToMultiByte( 0,0,pWstr,nLength,pcstr,nBytes,NULL,NULL );
return pcstr;
}
wchar_t* CharToWideChar( char * pchar,wchar_t* pWChar,size_t nLen )
{
size_t size = MultiByteToWideChar( CP_ACP,0,pchar,-1,NULL,0 );
if ( size > nLen )
{
size = nLen;
}
if ( !MultiByteToWideChar( CP_ACP,0,pchar,-1,pWChar,size ))
{
return pWChar;
}
return NULL;
}