Thread: text color

  1. #31
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Originally posted by Kyoto Oshiro
    I always use <conio.h> and their textcolor, although it may not work for you...
    Code:
    textcolor(RED);
    textbackground(BLACK);
    clrscr();
    You have to do a clrscr(); afterwards to have the changes take effect. That means that only 1 color on the screen at a time, there is a way to do it with more than 1 color, I am sure if you keep posting someone will give you the code.
    Anyhow, look through conio.h for all of the colors that you can use, and I think you must always type them in capitals.
    RED, BLUE, GREEN, YELLOW, LIGHTCYAN, stuff like that, check out conio.h

    Hope that helps. And if I am way off topic (as usual), just ignore me (as usual )
    What's the difference between clrscr() and system("CLS") ?? And what header file does the 1st one require?
    Thanks
    what does signature stand for?

  2. #32
    Registered User Unreg1stered's Avatar
    Join Date
    Jul 2002
    Posts
    25
    clrscr(); - // use conio.h

    system ("cls"); // use stdlib.h

  3. #33
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    What's the difference??
    what does signature stand for?

  4. #34
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608
    beats me
    Email: [email protected] || AIM: MisterSako || MSN: [email protected]

    -the shroom has spoken

  5. #35
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    I'm serious
    what does signature stand for?

  6. #36
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Originally posted by Kyoto Oshiro
    I always use <conio.h> and their textcolor, although it may not work for you...
    Code:
    textcolor(RED);
    textbackground(BLACK);
    clrscr();
    You have to do a clrscr(); afterwards to have the changes take effect. That means that only 1 color on the screen at a time, there is a way to do it with more than 1 color, I am sure if you keep posting someone will give you the code.
    Anyhow, look through conio.h for all of the colors that you can use, and I think you must always type them in capitals.
    RED, BLUE, GREEN, YELLOW, LIGHTCYAN, stuff like that, check out conio.h

    Hope that helps. And if I am way off topic (as usual), just ignore me (as usual )
    You were right... it doesnt work for me
    Errors:

    F:\Projects\Temp\main.cpp
    [Warning] In function `int main(int, char**)':
    7 F:\Projects\Temp\main.cpp
    `RED' undeclared (first use this function)
    (Each undeclared identifier is reported only once for each function
    7 F:\Projects\Temp\main.cpp
    `textcolor' undeclared (first use this function)
    8 F:\Projects\Temp\main.cpp
    `BLACK' undeclared (first use this function)
    8 F:\Projects\Temp\main.cpp
    `textbackground' undeclared (first use this function)
    9 F:\Projects\Temp\main.cpp
    `clrscr' undeclared (first use this function)
    F:\Projects\Temp\Makefile.win
    [Build Error] [main.o] Error 1
    what does signature stand for?

  7. #37
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608
    if u r using dev c++4 u gotta go to project>project options>add header file> find conio.o its under c:\dev-c++\libs\ by defualt
    Email: [email protected] || AIM: MisterSako || MSN: [email protected]

    -the shroom has spoken

  8. #38
    Registered User Unreg1stered's Avatar
    Join Date
    Jul 2002
    Posts
    25
    Originally posted by Ruski
    What's the difference??
    clrscr(); // works with the screen actually, I think

    system ("cls"); // this just send a command to the dos shell to clear the screen

  9. #39
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Originally posted by Klinerr1
    if u r using dev c++4 u gotta go to project>project options>add header file> find conio.o its under c:\dev-c++\libs\ by defualt
    How come not #include <conio.h> just like iostream and others?
    what does signature stand for?

  10. #40

  11. #41
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608
    i use devc++ 4 and clrscr(); works for me
    Email: [email protected] || AIM: MisterSako || MSN: [email protected]

    -the shroom has spoken

  12. #42
    Registered User Unreg1stered's Avatar
    Join Date
    Jul 2002
    Posts
    25
    Originally posted by Klinerr1
    i use devc++ 4 and clrscr(); works for me
    It works for you because you include the conio.o that DEV people port it to use with Dev C++.

  13. #43
    Registered User toxic-ram's Avatar
    Join Date
    Jul 2002
    Posts
    1
    I tried using textcolor() and textbackground() but there were problems. I did the following:
    Code:
    #include <iostream.h>
    #include <conio.h>
    
    void main()
    {
    	textcolor(BLUE);
    	textbackground(RED);
    	clrscr();
    	cout << "This is a test...";
    }
    Attached is a screenshot of the results. Can someone help me?

  14. #44
    Sir Mister Insane Sako Klinerr1's Avatar
    Join Date
    May 2002
    Posts
    608
    no u didnt. u gotta go to project>project optins> include file header its conio.o under devc++\lib i think thats your problemc ause i had that problem before
    Email: [email protected] || AIM: MisterSako || MSN: [email protected]

    -the shroom has spoken

  15. #45
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Thanks I'll check that out
    what does signature stand for?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. GUI Text Color Problem
    By justlivelife15 in forum Windows Programming
    Replies: 3
    Last Post: 06-25-2007, 05:47 AM
  2. Change text color in C
    By IndioDoido in forum C Programming
    Replies: 9
    Last Post: 04-15-2007, 05:54 AM
  3. Critique my lighting model.
    By psychopath in forum Game Programming
    Replies: 4
    Last Post: 08-12-2006, 06:23 PM
  4. Color text from windows.h?
    By Saintdog in forum C++ Programming
    Replies: 10
    Last Post: 12-03-2004, 09:20 AM
  5. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM