Hello everyone!
I am writing a C program that produces a large output file. To increase readability, I would like to collect certain kinds of output at certain points in the file rather than have it be scattered randomly about.
Consider a file like:
log
log
(a)
output
output
output(b)
Say the program is currently writing the line at (b). Is there a particularly elegant way in C to achieve the effect of moving to point (a), adding a line out output and then resuming normal output at (b)?
I know I could achieve this effect using standard shell tools such as csplit to break the file at the specified point, append output to the first half and then cat it back together. However, this application must be cross-platform so I can't count on having a shell available.
Any suggestions would be most helpful!