你可能需要在两者之间重置字符串流,但我从来没有那个 问题。 I"m suspecting that the stringstream is having "12" instead of "1 2" orsoemthing. I would try the following til I found what worked. from = "1";conv << from;conv >to; from = " 2";conv << from;conv >to; if that didnt'' work see what from = "1 2";conv << from;conv >to;conv >to; gives you. You may need to reset the stringstream in between, but I''ve never had thatproblem. 尝试: conv.clear(); Try:conv.clear(); 问候, Sumit。 Regards,Sumit. 无效。 from =" 2" ;; conv<< from; 没有改变conv的内部缓冲区,conv.str()仍然返回1。 didn''t work.from = " 2";conv << from;didn''t change the inner buffer of conv, conv.str() still returned "1". 这是有用的。 this worked. 这篇关于使用stringstream进行类型转换的奇怪问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-09 23:12