特殊空格

ofstream fo("log");
 11     ucs_char_t ucs_buf[10];
 12     ucs_buf[0] = 0x61;
 13     ucs_buf[1] = 0x62;
 14     ucs_buf[2] = 0x65;
 15     ucs_buf[3] = 0xa0;
 16     ucs_buf[4] = 0x4d;
 17     ucs_buf[5] = 0x58;
 18     ucs_buf[6] = 0xa0;
 19     ucs_buf[7] = 0x6211;
 20     ucs_buf[8] = 0;
 21     char char_buf[20];
 22     ucs_uc_to_utf8_buf(char_buf, ucs_buf,20);
 23     string str(char_buf);
 24     cout << str <<endl;
 25     fo << str << endl;
 26     stringstream ss;
 27     ss << str;
 28     string tok;
 29     cout << "stringstream\n";
 30 
 31     fo << "stringstream\n";
 32     while (ss >> tok) {
 33         cout << tok <<endl;
 34         fo << tok <<endl;
 35     }
 36     fo.close();

需要将普通空格(0x20)替换为特殊空格(0xa0),但是stringstream也不会处理这个特殊空格

output:

abe MX 我
stringstream
abe MX 我




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值