how to erase data from opended file

Hi.
Is there a way to erase data from opened file.
I have class to log some info.
and I did
1
2
3
4
5
//...
FILE* hand= fopen("log.txt","wt");
//... some actions that may change default dir
fprintf(hand,"some log info");
//... 

but that file is usualy to large, and I need only the last log.
is there a way to do that ?
Apache log4cxx has a rolling log appender: http://logging.apache.org/log4cxx/index.html

You might find that useful.
Topic archived. No new replies allowed.