《C++ Primer Plus》学习笔记11
第17章 输入、输出和文件
主要内容:
1)C++角度的输入和输出
2)iostream类系列
3)重定向
4)ostream类方法
5)格式化输出
6)istream类方法
7)流状态
8)文件I/O
9)使用ifstream类从文件输入
10)使用ofstream类输出到文件
11)使用fstream类进行文件输...
分类:
编程语言 时间:
2014-07-25 11:25:31
阅读次数:
318
#include
#include
#include
using namespace std;
int main(){
ifstream in("E:\\read.txt");
string s;
int t=0,j,start;
int i=0;
while(getline(in,s)){
//cout<<s<<endl;
// t++;
for(j=...
分类:
其他好文 时间:
2014-07-24 10:37:01
阅读次数:
390
/*
ID: lucien23
PROG: sort3
LANG: C++
*/
#include
#include
#include
#include
using namespace std;
void exchange(int nums[], int begin, int end, int N, int x);
int sum = 0;
int main()
{
ifstream ...
分类:
其他好文 时间:
2014-07-19 02:12:25
阅读次数:
176
1. fstream 继承自iostream --> 要包含头文件#include2. 建立文件流对象3. 打开文件夹4. 测试是否打开成功5. 进行读写操作6. 关闭文件#include#includeusing namespace std;int main(){ ifstream ifil...
分类:
编程语言 时间:
2014-07-17 22:38:12
阅读次数:
283
使用ifstream和getline读取文件内容[c++]
分类:
编程语言 时间:
2014-07-14 21:13:42
阅读次数:
213
在Linux下编程习惯了使用命令行参数,故使用VS2010时也尝试了一下。
新建项目,c++编写程序如下:
#include
#include
using namespace std;
int main(int argc,char*argv[])
{
ifstream fin(argv[1],ios::in);//输入方式打开文件
//ifstream fin;fin.open(argv...
分类:
其他好文 时间:
2014-07-12 21:01:31
阅读次数:
296
1 #include 2 #include 3 #include 4 #include 5 int main(int args, char **argv) 6 { 7 std::ifstream fin("GetDltWDu_7_list.txt", std::ios::in); ...
分类:
编程语言 时间:
2014-07-01 13:41:01
阅读次数:
210
#include "my_file.h"
//将文件内容拷贝到指定文件
int mycopy(const char *filename)
{
ifstream infile(filename, ios::binary);
ofstream outfile("TRACE.txt", ios::binary);
if (!infile.is_open() || !outfile...
分类:
其他好文 时间:
2014-06-28 08:46:56
阅读次数:
199
在看C++编程思想中,每个练习基本都是使用ofstream,ifstream,fstream,以前粗略知道其用法和含义,在看了几位大牛的博文后,进行整理和总结:这里主要是讨论fstream的内容:[java]view plaincopyprint?#includeofstream//文件写操作内存写...
分类:
编程语言 时间:
2014-06-27 00:30:11
阅读次数:
378
C++对文件处理没有shell等脚本语言方便,但也不是无计可施。#include #include #include #include using namespace std;int main(){ ifstream in("a.txt"); ofstream out("b.txt"); if(!i...
分类:
编程语言 时间:
2014-06-18 18:27:39
阅读次数:
231