stringstream 的用法

吐数据到指定类型:     

string str = "2703790455";
        printf("str is %s\n",str.c_str());
        stringstream tmp_val;
        tmp_val.str("");
        tmp_val << str;
        unsigned int ip;
        tmp_val >> ip;
        printf("uint is %u\n",ip);

格式化数据:

      stringstream tmp_val;
      tmp_val.str("");
      int i = 1;

      tmp_val << i;

你可能感兴趣的:(String)