Home > Q&A > body text
using namespace std;int main(){
ostringstream ostr("abcd"); ostr.put('1'); cout<<ostr.str(); cout<<endl; ostr<<"hi"; ostr.put('56'); ///这边为何不是输出1bc56 而是1bc6? cout<<ostr.str();
}
PHP中文网2017-04-18 10:50:08
ostringstream对象的put操作参数为charType. Reference
ostringstream
put
char
Essentially equivalent to put((char)'56')
put((char)'56')