The question depends on what type of recording is taking place. If you use standard buffered I / O, which is usually the default by default for a program, then the buffer will be cleared only after several lines are written, and when they are flushed, this will not necessarily be an integer number of lines. If you use write (2) or changed the default stdio buffering to be string or unbuffered, then it will alternate correctly if the lines are of reasonable size (of course, if the lines are less than 512 bytes).
source share