void c2w(wchar_t *pwstr,size_t len,const char *str)
{
if(str)
{
size_t nu = strlen(str);
size_t n =(size_t)MultiByteToWideChar(CP_ACP,0,(const char *)str,(int)nu,NULL,0);
if(n>=len)n=len-1;
MultiByteToWideChar(CP_ACP,0,(const char *)str,(int)nu,pwstr,(int)n);
pwstr[n]=0;
}
}
char *w2c(char *pcstr,const wchar_t *pwstr, size_t len)
{
int nlength=wcslen(pwstr);
int nbytes = WideCharToMultiByte( 0, 0, pwstr, nlength, NULL, 0,NULL,NULL );
if(nbytes>len)
nbytes=len;
WideCharToMultiByte( 0, 0, pwstr,nlength, pcstr, nbytes, NULL, NULL );
return pcstr ;
}