Thread: colour

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    1

    Question colour

    Hi there.Does anybody know how to use printf or any other printing function,so that i can print coloured text?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    cprintf() (notice the c)
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User Vber's Avatar
    Join Date
    Nov 2002
    Posts
    807

    If you're using Windows,

    you can use:

    void textcolor (int color);
    void textbackground (int color);

    They are in Conio, remember, this isn't ANSI.

    example:
    Code:
    #include <stdio.h>
    #include <conio.h>
    
    int main(void)
    {
        textcolor(5);
        printf("This is colored\n");
        textcolor(2);
        printf("This is an another colored sentence\n");
        
        getchar(); /* pause */
        return 0;
    }

  4. #4
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    this topic is alrdy mentioned enough but
    the best way to check what function u should use is to check the library reference that comes along with the compiler because
    it differs from compiler (BC,GCC,LCC).
    I dont know if this question is in the F.A.Q board
    But IMO i think this Q has to be in it.....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-24-2006, 08:36 PM
  2. Curses-- colour pairs
    By sufthingol in forum C++ Programming
    Replies: 0
    Last Post: 03-21-2005, 08:26 PM
  3. Replies: 5
    Last Post: 03-01-2003, 04:52 PM
  4. DirectDraw colour matching
    By Hunter2 in forum Game Programming
    Replies: 2
    Last Post: 12-10-2002, 02:17 PM
  5. Colour theory... (weird title)
    By Magos in forum C++ Programming
    Replies: 5
    Last Post: 11-25-2001, 04:16 PM