> On 8 Oct 2014, at 21:08, Alex Zavatone wrote:
>
> Why not check the file size before writing?
Ah, yes, like a kid who picks up the binoculars fat-end first, I was looking at
things the wrong way around (how to limit the size instead of getting the size
and doing something with that info).
Why not check the file size before writing? If the file size > your max, then
get the length of the message you are about to write and trim that many chars
from the front of the file before writing.
Or append the message to your file and after writing, check the file size and
trim the surplus
Hi folks
I have an app which needs to save some of its data into a log file. I have the
method set up already for creating and appending the log file. However, I'd
like to limit the file size and initiate a file turn over when it reaches a
certain size. What is the best way to accomplish this?