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

Asked 2 years ago, Updated 2 years ago, 98 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.