Thread: location specific console colors

  1. #1
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401

    location specific console colors

    back in the old days of qbasic progamming, i remember the command:

    Code:
    color(4,0)
    which would set the foreground of the current cursor location to color 4 and the background to 0. this would make it possible to make highly colorful progs, with this letter in red, that letter in blue, etcetera.

    is this possible in C?

    im using turbo c 2.01 by the way
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #2
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    i think the function is

    >> textcolor(int color);

    i think you'll need conio.h for that

    try using highvideo() (i think) aslo

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    nah that didn't work dog.

    the color didn't change at all
    this is the code:
    Code:
    #include <stdio.h>
    #include <conio.h>
    
    int main()
    {
         textcolor(4);
         printf("Hello Earthlings");
         return 0;
    }
    any probs there?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  4. #4
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    well, try cprint(), maybe that'd work

  5. #5
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    sorry, that should've been cprintf()

  6. #6
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    thanks cprintf() worked perfectly

    i cant find out how to turn off the cursor though, or change its size, how can i do that?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  7. #7
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    I don't think that's possible in text-mode apps.
    You'll have to switch to graphics mode.

  8. #8
    Registered User stormbringer's Avatar
    Join Date
    Jul 2002
    Posts
    90
    well, if using dos i remember that you can do pretty much including some lines of assembler. but i don't really remember. if you're interested i can look it up.

    but changing the size ain't possible (just if you switch the graphic mode (or console mode).
    Last edited by stormbringer; 07-24-2002 at 09:39 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Output to console window...
    By alvifarooq in forum C++ Programming
    Replies: 2
    Last Post: 10-26-2004, 08:56 PM
  2. Game console input
    By glUser3f in forum Game Programming
    Replies: 3
    Last Post: 11-07-2003, 04:33 AM
  3. Linux console window questions
    By GaPe in forum Linux Programming
    Replies: 1
    Last Post: 12-28-2002, 12:18 PM
  4. Accessing a Specific Text Line Inside CEditView :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 04-14-2002, 08:12 PM
  5. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 10:19 AM