//將CString(Unicode) 轉成 char 以下可轉中文
char* CStringToCharArray(CString str)
{
char *ptr;
#ifdef _UNICODE
LONG len;
len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
ptr = new char [len+1];
memset(ptr,0,len + 1);
WideCharToMultiByte(CP_ACP, 0, str, -1, ptr, len + 1, NULL, NULL);
#else
ptr = new char [str.GetAllocLength()+1];
#endif
return ptr;
}