Thread: Font Color

  1. #16
    Registered User
    Join Date
    May 2002
    Posts
    41
    I'm confused on the code.
    Shouldent NULL be, 78, 85, 76, 76, or just 0 or, 4E, 55, 4C, 4C

  2. #17
    Registered User red_baron's Avatar
    Join Date
    May 2002
    Posts
    274
    ok much simpler it is basically this:

    SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), colour#);

    so just put in a number where colour# is anything between 0 and 256 then everything you print after that code will be in that colour.
    ¿Red Baron?

    "Imagination is more important than knowledge"
    -Albert Einstein (1879-1955)

    Check out my games!

    [code] /* dont forget code tags! */ [/code]

  3. #18
    Registered User
    Join Date
    May 2002
    Posts
    41
    Thank you so much. It wasent working it first but I forgot to include the <windows.h> header.
    Shouldent NULL be, 78, 85, 76, 76, or just 0 or, 4E, 55, 4C, 4C

  4. #19
    Registered User
    Join Date
    Oct 2004
    Posts
    3
    THE Attached Files VERY GOOD

  5. #20
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    u might try doing some stuff with the video memory.the video memory starts from b8000000H.every letter that is displayed has 2 bytes attached to it in the video memory,thats in layman terms,i dont know how to put it into proper technical language.
    the first byte represents the letter that is to be displayed.the next 2 are the attributes of the text.that is whether u want the text to be displayed in some particular color,whether it is blinking ...
    you can play around with it if u want.

    here is some sample code
    Code:
     #include<stdio.h>
    #include<conio.h>
    #include<stdlib.h>
    #include<graphics.h>
    #include<initgrp.h>
    #include<clearsc.h>
    int main()
    {
     char far  *ptr=0xb8000001;
     int i;
     clear();
     for(i=0;i<4000;i++)
     {
      *ptr=0x04;
      ptr+=2;
     }
     printf("this is the last value of  i        %d",i);
     getch();
     return 0;
    }
    this will display the text in red.i know that this is somewhat of a weird way of changing colors,but well,i think this should work.try it only if your functions dont get you anywhere.
    hope this was helpful
    ciao

  6. #21
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Critique my lighting model.
    By psychopath in forum Game Programming
    Replies: 4
    Last Post: 08-12-2006, 06:23 PM
  2. problem with my font manager
    By hannibar in forum C Programming
    Replies: 1
    Last Post: 03-07-2006, 08:03 AM
  3. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 10:18 PM
  4. RichEdit Font Color
    By Unregistered in forum Windows Programming
    Replies: 2
    Last Post: 11-01-2003, 04:07 PM
  5. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 10:19 AM