入门计划->使用(C++库)istringstream输入(格式化)
2003-07-30 16:51
781 查看
原创+收藏
不太明白
//awzzz@2002 //入门计划->使用(C++库)istringstream输入(格式化) //APO->using istringstream. //accidence project of using istringstream.(c++ iostream library) /* Reference: http://www.cplusplus.com/ref/iostream/istringstream/ Description istringstream class provides an interface to manipulate strings as if they were input streams. The objects of this class mantain internally a pointer to a stringbuf object that can be obtained/modified by calling member rdbuf. This streambuf-derived object stores a sequence of characters (string) that can be obtained/modified by calling member str. */ //使用(C++库)istringstream输入(格式化) //simple example #include <iostream> #include <sstream> #include <string> using namespace std; void test() { { //istringstream iss; //iss.str("#123 1.23 aaa ,zzz kk,k oo.jjj"); istringstream iss("#123 1.23 aaa ,zzz kk,k oo.jjj"); cout << iss.str() << endl; char ch; iss >> ch; cout << ch << endl; int i; iss >> i; cout << i << endl; float f; iss >> f; cout << f << endl; char buf[1024]; iss >> buf; cout << buf << endl; iss.ignore(100, ','); iss >> buf; cout << buf << endl; } } int main(int argc, char* argv[]) { test(); return 0; }
相关文章推荐
- 入门计划->使用(C++库)ostringstream输出(格式化)
- 入门计划->使用(C++库)ofstream写文件数据
- 入门计划->使用(C++库)ifstream读文件数据
- 入门计划->使用(C++库)fstream读写文件
- 入门计划->使用(C++库)fstream读写文件
- 使用(C++库)istringstream输入(格式化)
- 使用(C++库)istringstream输入(格式化)
- 使用(C++库)istringstream输入(格式化)
- 使用(C++库)istringstream输入(格式化)
- 入门计划->学用stl std::map<std::string, int>
- <Boost> VS2010使用Boost(C++库)
- <frameset>使用注意以及页面输入乱码解决
- 使用NumberFormatter判断TextInput输入内容是否为数字,如果是则格式化数字。
- 使用jdom来格式化输入xml
- Python入门的36个例子 之 35 -> try – 一个使用的例子
- ArcGIS API for Silverlight开发入门(8):在程序中使用Virtual Earth的服务<转>
- arcgis api for flex 开发入门(三)地图浏览控件的使用<转>
- arcgis api for flex 开发入门(七)Geometry service 的使用<转>
- JavaEE--------> Hibernate入门 -->使用Hibernate实现数据的删改
- arcgis api for flex 开发入门(四)Darw控件的使用<转>