[转载] Re: [转载] 这样读多个文件对吗?# Programming - 葵花宝典
y*i
1 楼
【 以下文字转载自 JobHunting 讨论区,原文如下 】
发信人: yunhai (飞纵千里山), 信区: JobHunting
标 题: Re: [转载] 这样读多个文件对吗?
发信站: Unknown Space - 未名空间 (Tue Apr 12 19:52:30 2005) WWW-POST
// Your first question
ifstream in;
char filename[2][] = {"a.txt", "b.txt"};
in.open(filename[0], ios::in);
while(in) {
// read
}
in.close();
in.open(filename[1], ios::in);
while(in) {
// read
}
in.close();
// second
ifstream in;
in.open ("a.txt", ios::in);
int size = 0;
char line[80];
while (in) {
// read one line
in >> line;
发信人: yunhai (飞纵千里山), 信区: JobHunting
标 题: Re: [转载] 这样读多个文件对吗?
发信站: Unknown Space - 未名空间 (Tue Apr 12 19:52:30 2005) WWW-POST
// Your first question
ifstream in;
char filename[2][] = {"a.txt", "b.txt"};
in.open(filename[0], ios::in);
while(in) {
// read
}
in.close();
in.open(filename[1], ios::in);
while(in) {
// read
}
in.close();
// second
ifstream in;
in.open ("a.txt", ios::in);
int size = 0;
char line[80];
while (in) {
// read one line
in >> line;