[开发工具]_[VS2010]_[vs2010的一个bug-使用stringstream时出现]


1. 注冊Microsfot之后想提交bug, 发现有这个提示, 所以提交不了bug, 有能提交的提交下吧.

You are not authorized to submit the feedback for this connection.


2. VS2010 sp1的bug, temp为居然为空.


TEST(test_Aa,StringStream)
{
	std::stringstream ss;
	ss << 0;
	const char* temp = ss.str().c_str();
	std::cout << "temp: " << temp << std::endl;
}

这里我使用vs2010 sp1的temp输出为空, g++就正常输出为0.

vs2010:

temp:


备注: 应该是微软实现的标准库的问题, 找时间研究下. 暂时解决的方法就是先把stringstream转换为string, 再从string调用c_str()就会有值.

原文地址:https://www.cnblogs.com/cynchanpin/p/6723741.html