DOS Colors?

This is a discussion on DOS Colors? within the C Programming forums, part of the General Programming Boards category; I've read the ansi.sys file someone provided for me. However it didn't explain to much. I've searched the boards and ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    17

    DOS Colors?

    I've read the ansi.sys file someone provided for me. However it didn't explain to much. I've searched the boards and found something about a textcolor(); function for displaying colors. I'm wondering why the color codes from the mud won't work though. This is an example of bold red from the mud.

    [1;31m

    When I run it through my log player however it just adds an arrow and shows the color code. Any suggestions on this? I've searched all over the 'net and boards and can't seem to figure it out.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You have to set up your dos session to use ansi.sys. Read the link I already gave you, and it says how to set it up:

    FILE:

    config.sys

    LINE:

    devicehigh=c:\windows\ansi.sys

    Here is another link. Just follow the instructions. It's not that hard.

    The 'textcolor' functions are for Borland's DOS compilers.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User Unimatrix139's Avatar
    Join Date
    Jun 2002
    Posts
    55

    Disp package

    I don't know if this is a univeral thing, but my compiler comes with a display package (disp.h) that lets you change colours, draw boxes etc. I personally use it and find it quite good - If you're compiler supports it I'd recommend it no external device drivers like ANSI.SYS are required and I think that's a big bonus.
    Kree'ta Tau'ri! Chaapa'ai!

  4. #4
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946

    Re: Disp package

    Originally posted by Unimatrix139
    I don't know if this is a univeral thing, but my compiler comes with a display package (disp.h) that lets you change colours, draw boxes etc. I personally use it and find it quite good - If you're compiler supports it I'd recommend it no external device drivers like ANSI.SYS are required and I think that's a big bonus.
    i agree. it's not like ansi.sys is a universal thing either.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    Re: Re: Disp package

    Originally posted by moi


    i agree. it's not like ansi.sys is a universal thing either.
    That's pretty funny. Any MS OS from what... DOS 2.1 or so onward? should have it. As such, it IS pretty universal. Yes there are the *nix operating systems and the like. However you're missing the real problem:

    You cannot have a standard library function do your color for you! As such, nothing you do will be a "universal thing". It's just not going to happen. End of story.

    You wanted to know why you ANSI escape codes didn't work, I told you. And since you are talking about a MUD here, yeah, it'd a pretty good idea to just set up ansi.sys.

    Back in my day boy, we didn't have fancy Windows MUD clients! <goes off on a rant>

    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946

    Re: Re: Re: Disp package

    Originally posted by quzah


    That's pretty funny. Any MS OS from what... DOS 2.1 or so onward? should have it. As such, it IS pretty universal. Yes there are the *nix operating systems and the like. However you're missing the real problem:

    You cannot have a standard library function do your color for you! As such, nothing you do will be a "universal thing". It's just not going to happen. End of story.

    Quzah.
    alright, you can either use non standard library functions (which i bet he already has in his program in other areas) and worry about changing your code once every time you port it to a new OS or compiler, or you can use ansi.sys and worry about changing your code every time you port it to a new OS anyway, but on top of that have all end users have to worry about installing ansi.sys to use your program.

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You obviously don't know what a MUD is. MUDs use ansi escape codes. Ansi escape codes are handled under DOS/Win by ansi.sys. Most *nix platforms have native support for these colors (I imagine they have their own version of ansi.sys they use.)

    If you are writing a non-console application for Windows, you will have to translated these to whatever your compiler uses for color.

    If you are using a console application, and you play muds (why else would you need a mud log viewer?) you likely already have ansi.sys loading. (Otherwise, why else are you using it in a console?)

    In other words: MUDs use ANSI escape codes. Ansi.sys translate them for you into their end result. Any questions?

    Quzah.
    Hope is the first step on the road to disappointment.

  8. #8
    moi
    moi is offline
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946
    Originally posted by quzah
    You obviously don't know what a MUD is. MUDs use ansi escape codes. Ansi escape codes are handled under DOS/Win by ansi.sys. Most *nix platforms have native support for these colors (I imagine they have their own version of ansi.sys they use.)

    If you are writing a non-console application for Windows, you will have to translated these to whatever your compiler uses for color.

    If you are using a console application, and you play muds (why else would you need a mud log viewer?) you likely already have ansi.sys loading. (Otherwise, why else are you using it in a console?)

    In other words: MUDs use ANSI escape codes. Ansi.sys translate them for you into their end result. Any questions?

    Quzah.
    i am sorry. no i was not aware of exactly what a mud was.

  9. #9
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    If you like text based adventure, drop in on The Mud Connector. THE site for mudding.

    Quzah.
    Hope is the first step on the road to disappointment.

  10. #10
    Registered User
    Join Date
    Jul 2002
    Posts
    17
    Quzah I did do the ansi.sys thing and it worked fine. However I wanted the program to be self serving. In other words it functions in itself and doesn't require the people I give it to, to go in and tamper with their sys files. But i've decided to leave it as is and just let ansi do it for me. Thanks for the info.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File systems?? (Winxp -> DOS)
    By Shadow in forum Tech Board
    Replies: 4
    Last Post: 01-06-2003, 08:08 PM
  2. colors in DOS console based applications
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 06-09-2002, 10:37 PM
  3. Colors in DOS console
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 06-08-2002, 07:32 PM
  4. DOS program versus DOS console program
    By scromer in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 01-10-2002, 12:42 PM
  5. Shut off DOS screen automatically to Windows
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 11-08-2001, 06:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21