I *do not* want to overwrite any of the data or delete the file.
I have a file that already contains some data and I want to add a line at the top of the file without overwriting anything. Using ofstream will not help me to do this.
I am now using:
WritetoTop(CString szErrorFile, CString szOutputFile)
{
if(!CopyFile( szErrorFile, szOutputFile, false))
{
AfxMessageBox("Error: Could not copy " + szErrorFile + "to " + szOutputFile);
return false;
}
else
{
PrintMessageToFile("</ROOT>", szOutputFile);
ofstream File(szOutputFile,ios:

ut | ios::in /*| ios::binary*/ );
File.seekp(ios::beg);
File.write("SomeText",sizeof("SomeText"

);
File.close();
}
return true;
}
But is still doesn't work.
Smilee