Code:
main()
{
 ofstream out;
 out.open(filename, ios::nocreate | iso::out);
 ...
 ...
 ...
 out.close();
 ...
 return 0;
}
That should do it