string wstr2str( const wstring & wstr) ... {// convert the wstring into string string curLocale = setlocale(LC_ALL, NULL); setlocale(LC_ALL, "chs"); char *buff = (char*) malloc(sizeof(char) * (wstr.size() * 2 + 1)); wcstombs(buff, wstr.c_str(), wstr.size() * 2 + 1); string str(buff); free(buff); setlocale(LC_ALL, curLocale.c_str()); return str;} wstring str2wstr( string & str) ... { // convert the string into wstring string curLocale = setlocale(LC_ALL, NULL); setlocale(LC_ALL, "chs"); wchar_t *buff = (wchar_t*) malloc(sizeof(wchar_t) * (str.size() + 1)); mbstowcs(buff, str.c_str(), str.size() + 1); wstring wstr(buff); free(buff); setlocale(LC_ALL, curLocale.c_str()); return wstr;}