【发布时间】:2012-01-08 08:37:55
【问题描述】:
我在 ANSII 中有以下代码:
boost::asio::streambuf buffer;
std::ostream oss(&buffer);
boost::asio::async_write(socket_, buffer,
strand_.wrap(
boost::bind(&Connection::handleWrite, shared_from_this(),
boost::asio::placeholders::error)));
我需要将其转换为 UNICODE。我尝试了以下方法:
boost::asio::basic_streambuf<std::allocator<wchar_t>> buffer;
std::wostream oss(&buffer);
boost::asio::async_write(socket_, buffer,
strand_.wrap(
boost::bind(&Connection::handleWrite, shared_from_this(),
boost::asio::placeholders::error)));
有没有办法在 UNICODE 中使用 async_write()?
【问题讨论】:
-
您的代码只使用了宽字符type。这(大部分)与字符 encodings... 正交
标签: c++ boost unicode stream boost-asio