| 
#include <string>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <set>
using namespace std;
void Check(set<string>& tab,const char* fnam,int l)
{
    if (tab.find(fnam) != tab.end()) return;
    ifstream f(fnam);
    if (!f) {
        cerr << "Can't open " << fnam << endl;
        return;
    }
    cout << setw(l) << "" << fnam << endl;
    tab.insert(fnam);
    string s, dpath = "c:\\Progra~1\\DevStu~1\\Vc\\Include\\";
    string::size_type   i,j;
    while (f >> ws, getline(f,s)) if (s.substr(0,8) == "#include") {
        i = s.find('<');
        j = s.find_last_of('>');
        if (i != string::npos && j != string::npos)
            Check(tab,(dpath+s.substr(i+1,j-i-1)).c_str(),l+2);
    }
}
int main(int argc,char** argv)
{
    if (argc < 2) {
        cerr << "usage : " << *argv << " file\n";
        return 1;
    }
    set<string> tab;
    Check(tab,argv[1],0);
    return 0;
}
 | 
| 
#include "etime.h"
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
    char    buf[20];
    CETime  e;
    int     i,n = 100;
    char    c;
    for (i=0;i<n;++i) {
        sprintf(buf,"data%.2d.txt",i);
        ifstream    f(buf);
        while (f.get(c)) ;
    }
    cout << e.Sec() << endl;
    e.Reset();
    ifstream    f("data.txt");
    while (f.get(c)) ;
    cout << e.Sec() << endl;
}
 | 
100 個のファイルは 1.8秒で、1個は 0.5秒で読めた。
1度に開けるファイルの数は、FOPEN_MAX を見ると 20 であるが、実際に開いてみると、
509個まで開ける。実際は 512個で、cin,cout,cerr の3個分足りないのであろう。
従って、include の深さは 500 ぐらいまで大丈夫であろう。