Clion doesn't print to console
Asked Answered
J

2

5

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 ?

Jacobi answered 22/2, 2016 at 14:28 Comment(1)
Line buffering. printf("%d\n", 15);Mastaba
H
10

printf buffers the output. It will not flush the buffer (i.e. 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.

Heeltap answered 22/2, 2016 at 14:33 Comment(0)
A
0

Had same problem. This was solution for me when using Clion.

  1. Use debug option when running program.

debug button

  1. Use fflush(stdout).
printf("Test\n");
fflush(stdout);

After that you should see output in your debug console.

Acklin answered 22/12, 2023 at 18:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.