简单的文件读写
2016-04-06 10:09
399 查看
include
include
using namespace std;void TestReadFile(){
ifstream file;
file.open(“C:/Users/Administrator/Desktop/cc.txt”, ios::in);
if (file.fail()) {
cout << “fail” << endl;
return;
}
istreambuf_iterator beg(file), end;
string str = string(beg, end);
cout << “str:” << str << endl;
file.close();
}
void TestWriteFile(){
fstream file;
file.open(“C:/Users/Administrator/Desktop/cc2.txt”, ios::out);
file << “hello” << endl;
file.close();
}
int main(){
// TestReadFile();
TestWriteFile();
return 0;
}
相关文章推荐
- android Google Map获取地理位置信息的方法
- Spark RDD API详解(一) Map和Reduce
- Python中map()函数浅析
- Android使用Google Map浅谈
- C#中Ilist与list的区别小结
- C#中IList<T>与List<T>的区别深入解析
- C#对list列表进行随机排序的方法
- Erlang中的映射组Map详细介绍
- Vc++ 控件List Control用法总结
- c++中map的基本用法和嵌套用法实例分析
- C++实现的泛型List类分享
- Mysql IO 内存方面的优化
- C#使用IComparer自定义List类实现排序的方法
- C# Datagridview绑定List方法代码
- 百度地图给map添加右键菜单(判断是否为marker)
- JavaScript中实现Map的示例代码
- javascript radio list的实现细节(多浏览器兼容)
- jquery中map函数与each函数的区别实例介绍
- jquery中map函数遍历数组用法实例
- jquery与google map api结合使用 控件,监听器