简体   繁体   中英

Clion doesn't print to console

I am using printf("%d", 15); and nothing prints on the console.

I tried calling setvbuf (stdout, NULL, _IONBF, 0); first, nothing changed. Any ideas how to tackle this issue ?

printf buffers the output. It will not flush the buffer (ie actually write out the contents) until a newline is reached.

The best remedy is to use printf("%d\\n", 15); . Alternatively you can flush the buffer using fflush(stdout);

You can suppress the buffering behaviour by writing setbuf(stdout, NULL); but I wouldn't recommend your interfering with the workings in that way.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM