6 ms·
write() is an OS system call, while printf() is a C function call. C libraries can (and do) choose to buffer printf, while read/write are usually unbuffered.
by gryph0n 12y ago
write() is an OS system call, while printf() is a C function call.
C libraries can (and do) choose to buffer printf, while read/write are usually unbuffered.
Of course, both are mechanisms are modifying some global state (your terminal's state), and cannot be relied to be free of race-conditions.