I am using the CLion IDE and I am trying to do a carriage return.
I am doing a print statement in C and have the following syntax:
printf("\rHello World!");
which is inside a loop. The loop still prints every Hello World
on its own line. There are no \n
's in my program. I've tried changing the line separators
options to unix
mac OS
and windows
and none of them change the functionality. Google has also led me to no useful answers.
int main()
{
int i = 0;
while (i < 5000000)
{
printf("\rThis is line number %d!", i++);
}
return 0;
}
My expected output is only a single line of text in the console window.
Thanks.