- 博客(3)
- 收藏
- 关注
原创 .eof() 以及std::getline(ifstream &, string &)
#include #include #include using namespace std; int main(){ ifstream infile("abc.txt"); if(!infile) {} ofstream outfile("out.txt"); string str; for(int i=0; i
2009-08-20 10:39:00 1934 1
转载 zz头文件sstream,strstream的区别
以前一直以为这两个就是一个样的,就名字的区别而已,今天编了个小程序,发现好象跟我想象的不大一样,请高手指点! C/C++ code#include #include #include #include using namespace std;//将整型转换成字符型string int_to_string(int i){ ostringstream os; os re
2009-07-13 19:31:00 1105
原创 getline函数的一点瓜葛
C++仍然有基本的字符数组,同时又有string这种数据类型(C++串,不是STL),前者大小固定,后者可以不固定。1. 作为友元函数的getline(istream, str) 比如论坛上常见的: string Str; getline(cin,Str);//从键盘读入一行到C++串Str 其实还有: ifstream infile("abc.t
2009-07-12 14:18:00 396
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人