1234567891011121314151617181920212223242526272829303132 |
- #include <iostream> // not needed for many systems
- #include <fstream>
- #include <string>
- #include <sstream>
- int main()
- {
- using namespace std;
- string filename = "file";
-
-
- int i;
- for (i = 0; i < 140; i++)
- {
- ostringstream outstr;
- outstr << filename << i;
- string fname = outstr.str();
- ofstream fout(fname.c_str());
- if (!fout.is_open())
- break;
- fout << "For your eyes only!\n";
- fout.close();
- fout.clear();
- }
- cout << "i: " << i << endl;
-
-
- return 0;
- }
|