hi
This is my first post.everybody know that printf() prints the screen. is their any way
that I can give color full out put using printf(). I mean is it possible to output colored
text to the dos prompt.
thanks.
hi
This is my first post.everybody know that printf() prints the screen. is their any way
that I can give color full out put using printf(). I mean is it possible to output colored
text to the dos prompt.
thanks.
There's no standard way.
It's platform specific...
See the FAQ: http://faq.cprogramming.com/cgi-bin/...&id=1043284392
Yes and no.
First of all, any "colour" output would be quite non-standard. So it would only work on certain systems. This by itself means that it's not part of printf itself.
You can make printf (or similar functions) output escape codes to print in colour, move the cursor around, etc, etc.
http://en.wikipedia.org/wiki/ANSI_escape_code
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
hi
hey guys I found this code also.But It works only with turbo C .
Code:#include <conio.h> int main(void) { int BLACK=0; int RED = 12; textcolor(RED); textbackground(BLACK); cprintf("It worked!"); getch(); return 0; }
hi
Cygwin Is it a linux IDE .I have downloaded a setup file which install from network dirctly. Can you give me direct link download it as a full package.
thanks.
I believe what you want is SetConsoleTextAttribute(). It has a lot of parameters you pass it, to set up the colors. This is a tiny snippet of code from Visual C. All it did was print a number of spaces in the color and intensity that I needed for that part of the display for a console (text), game program.
If you google this, SetConsoleTextAttribute, you'll get what you want. Much easier to work with than ANSI escape codes.Code:SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED); printf(" \n ");