If you're trying to just create a file then it's simpler then you are making it look:
1 2 3 4 5 6 7 8 9 10 11 12
#include<iostream>
#include<fstream>
int main(int argc, char *argv[])
{
std::ofstream OutFile("NameOfFile.txt", std::ios_base::out);
OutFile << "My Data\n";
OutFile.close();
return 0;
}
EDIT: This will drop a file named "NameOfFile.txt" into your relative path. If you want it in a different directory then you need to specify the directory using UNC.