I want to print a colored sentence, My code:
#include<stdio.h>
int main()
{
printf("\033[0;34m");
printf("This is Blue");
return 0;
}
And this is output:
[0;34mThis is Blue
How can I fix this problem?
I want to print a colored sentence, My code:
#include<stdio.h>
int main()
{
printf("\033[0;34m");
printf("This is Blue");
return 0;
}
And this is output:
[0;34mThis is Blue
How can I fix this problem?
Your program does exactly what it is supposed to do: output what you tell it to to the console.
However, if you are expecting to see colors when sending ANSI/VT100 codes to the console the console must understand these codes.
You didn't mention what operating system and console you are using.
If it's Windows for example the console doesn't support ANSI/VT100 codes by default (to enable see: https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences?redirectedfrom=MSDN).
If it Unix or Linux you may need to check what the TERM environment variable is set to and if that is supported by the console application you're using.
If you are using a remote console (like PuTTY on Windows) you may need to set the terminal type to xterm-color
.