文章标签 ‘源代码’

在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; }

2010年1月27日17:36 | 没有评论
分类: C/C++