wstr and str
来源:互联网 发布:米表cms 编辑:程序博客网 时间:2024/06/05 17:40
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;
}
{// 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;
}
{// 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;
}
- wstr and str
- str and repr 函数
- IPMsg之Wstr类
- django static Cannot mix str and non-str arguments
- Array vector string and C str
- [Python]Input/Output and str Formatting
- str
- str()
- str
- str
- str
- Difference between char *str=“STRING” and char str[] = “STRING”
- Python 2.7 Data Type for Text Strings: Unicode and Str
- Python---TypeError: '<' not supported between instances of 'str' and 'int'
- TypeError: '<' not supported between instances of 'str' and 'int'
- TypeError: unsupported operand type(s) for +: 'int' and 'str'
- str=str.replace("<","!");
- str.compareTo(str)
- jstl简介及自己项目中所用到的jstl
- 关于sql索引的问题
- FreeBSD 基礎建設 - Context Switch
- 在word文档中加进参考文献的标注(转)
- 博客开张!
- wstr and str
- RBAC权限模型的运用
- 新一代图书馆集成管理系统问世
- KeyStore中的别名
- 鱼的7秒
- 从Web 2.0到Enterprise 2.0 (一)
- asp.net如何连接sql server2000数据库
- sql2005的xml字段类型在.net中的应用
- DLL初学者指南