why not just do it with an fstream?
Code:
#include <fstream>

...

ofstream outfile;
outfile.open("name.txt");
Also if you're running vista you must manually locate the app in the debug dir and run in admin mode for any file interaction to work properly.