Why doesn't printf print out if I don't write the opening letter?

Asked 1 years ago, Updated 1 years ago, 88 views

Why doesn't printf automatically print out if you don't write the opening letter? Is that what POSIX decided? How do I automatically print out every time I printf()?

linux c printf

2022-09-22 22:22

1 Answers

The standard output stream is buffered I/O Do not flush until the buffer is full or until you meet the opening character.

To make flush automatically whenever printf() is done

fprintf (stderr, "right out");
printf ("fflush will pick you up");
fflush(stdout);
setbuf(stdout, NULL);


2022-09-22 22:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.