Home > Net >  Why doesn't Clion execute any printing command in console while debugging?
Why doesn't Clion execute any printing command in console while debugging?

Time:10-14

The Console in CLion doesn't print anything during debugging step-by-step (only after it gets to end of the code). I have no idea whether if this is normal, but if you can help to adjust the settings (if possible) so that it do the printing in the console as well (so that I can follow the code execution better), that would be great.

I'm a total newbie, fresher at university, so please excuse this very basic question. Please try to give me the necessery steps in a way that I could understand. Thanks for your help.

CodePudding user response:

Printf does not print directly to the console output, instead it adds the string to an output buffer. For better performance, the output buffer is not printed all the time.

To force the output buffer to be cleared and printed, you can use:

fflush(stdout);
  • Related