0
我想从每个文件打印第一行,但我认为它输出的地址,而不是。从文件打印行
#include <fstream>
#include <iostream>
#include <cstdlib>
using namespace std;
void FirstLineFromFile(ifstream files[], size_t count)
{
const int BUFSIZE = 511;
char buf[BUFSIZE];
ifstream *end, *start;
for (start = files, end = files + count; start < end; start++)
{
cout << start->getline(buf, sizeof(buf)) << '\n';
}
}
为(开始=文件,结束=文件+计数;启动<端;开始++){ \t函数getline(*开始,S); \t cout << s <<'\ n'; } – blitzeus