As the title says, that happens. When I'm debugging in the Eclipse IDE, printf never seems to appear. After a while, I discovered that they print when the code is executed all the way. However, this is very unfortunate, because I never get to see what is happening in the console. Does anyone know how to fix this?
Asked
Active
Viewed 467 times
0
-
4have you ended your strings by `\n` ? or used `fflush(stdout)` – Jean-François Fabre Jul 23 '21 at 08:18
-
Hello, I don't know about your IDE but I know there is sometimes a weird behavior with the printf function, not printing when it should. I believe using the write function should resolve the problem. For printing a string : "write(1, str, strlen(str))" – Achille G Jul 23 '21 at 08:47
-
@AchilleG `write(1,...` is not a replacement for `printf`. – Jabberwocky Jul 23 '21 at 08:52
-
@Jabberwocky May I ask why ? It does achieve the same purpose, unless I'm missing something – Achille G Jul 23 '21 at 08:56
-
1@AchilleG how can `write` replace say `printf("%10d\t%20s\n", foo, bar)`? – Jabberwocky Jul 23 '21 at 08:59
-
1`printf()` outputs into `stdout`, which is commonly a line-buffered stream. This means that it collects the characters to output until an end-of-line is encountered, or you call `fflush()` on it, before it actually outputs. Additionally, several IDEs assign other streams to it, or do some buffering on their own. – the busybee Jul 23 '21 at 09:05