Hi Pola,
Thanks for posting in the community.
First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to use the ofstream to
append the data from the end of the file.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.
I think you may try the code below.
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
SYSTEMTIME lpTime;
GetSystemTime(&lpTime);
ofstream x;
x.open( "aaa.rep",ios_base::app); // file contains line: 012345678
x<<lpTime.wDay<<"/"<<lpTime.wMonth<<"/"<<lpTime.wYear<<" "<<lpTime.wHour;
x.close();
return 0;
}
As for the seekp function, from the MSDN:
Reset position in output stream.
It is used to reset the posistion in output stream, when you open file as
ofstream, the original file content is not the ofstream. So it seems the
seekp did not work, and I think it works as the design.
basic_ostream::seekp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcstdlib/ht
ml/vclrf_ostream_basicostreamseekp.asp
Please apply my suggestion above and let me know if it helps resolve your
problem.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.