I'm writing a program that generates a large log file (+10GB) on completion. To split this up, in my logging function I redirect output to a new file name once n lines have been written.
However, some lines in this file can be huge (+100k chars) and some are no more than 10 chars, and the large ones can be clustered. I would much rather split the output by size in bytes rather than by line.
What's the most lightweight method for keeping an ongoing track of the number of bytes that have been sent to a c++ stream?