the basic problem is that setw and fillchar do not seem to work with string streams, at least in vc2005/2008 compilers. is it non-standard? what is the proper way doing it? Thank you.
// Step 1: Include libraries
#include <iostream>
#include <fstream>
#include <string>
usingnamespace std;
// Step 2: Define used variables
ofstream f1;
ifstream f2;
string path;
int main()
{
// Step 3: Use a mid-file to keep the addresses of all the files
f1.open("log.txt");
for (int x=1; x<=100; x++) {
if (x<10)
f1 << "00";
elseif (x<100)
f1 << "0";
f1 << x << ".dat\n";
}
f1.close();
// Step 4: Create the files
f2.open("log.txt");
for (int x=1; x<=100; x++) {
getline(f2, path);
f1.open(path.c_str());
f1.close();
}
f2.close();
// Step 5: Delete the mid-file
remove("log.txt");
// Step 6: Inform the user that it's operation has been completed
cout << "Done!\n";
// Step 7: Close the program
return 0;
}
*Stares in disbelief*
I... I'm sorry I...
I want to use Cpt. Picard here, but I... I'm sorry, this is just too much.
I can at least still comfort myself with the fact that I'll probably never have to work with you, CManowar.