CLion 2021.3.2 adding random newline characters in the terminal output?

Answered

It appears CLion is adding random newline characters in the terminal which is mucking up the output. Using Build #CL-213.6461.75, built on December 28, 2021.

I've tried the same code in several other editors/ IDE's with no issues. 



Here's the simple code used: 

#include <stdio.h>

int main(void) {
long num;
long sum = 0L;
int status;

printf("Please enter an integer to be summed ");
printf("(q to quit): ");
status = scanf("%ld", &num);
while (status == 1)
{
sum = sum + num;
printf("Please enter next integer (q to quit): ");
status = scanf("%ld", &num);
}
printf("Those integers sum to %ld.\n", sum);

return 0;
}
0
2 comments

Hello!

You can try using an external console - enable the "Run in external console" option in your run/debug configuration (Run | Edit Configurations...).

2

Hi Anna, 

That works. I just have to make provisions to keep the external console window open like using multiple getchar() functions or system("pause"). Thank you! 

0

Please sign in to leave a comment.