文章标签 ‘WideToASCII’
在Chromium(Google Chrome浏览器的开源项目)源代码里看到一个字符串转换函数WideToASCII: #include <iostream> #include <string> std::string WideToASCII(const std::wstring& wide) { return std::string(wide.begin(), wide.end()); } int main() { std::wstring ws(L"Test String"); std::string s(WideToASCII(ws)); std::wcout < < L"Wide: " << ws << std::endl; std::cout << "ASCII: " << s << std::endl; return 0; }
分类: C/C++
