Find the answer to your Linux question:
Results 1 to 4 of 4
help buddy... i have a problem.. i know how to program in linux in c and c++ and have made several commands like "ls","cat" etc.. now see when we do ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2005
    Posts
    2

    colour my programs


    help buddy... i have a problem.. i know how to program in linux in c and c++ and have made several commands like "ls","cat" etc.. now see when we do ls it displays file names of the present directory... i want to do such that when my prog of ls displays the file name it do so in some different color say red or orange etc which will b defined in my prog.... can any one help....

    if possible pls pm me

  2. #2
    Linux Engineer
    Join Date
    Mar 2005
    Posts
    1,431
    Please turn of the colors, thei're hurting my eyes!

    I know thei're called "ANSI colors", that's all I know, google it... Or wait for someone else to answer.

  3. #3
    Linux Engineer
    Join Date
    Nov 2004
    Location
    home
    Posts
    796
    Colors is quite easy really. Just print the ansi code and let the terminal figure it out. Example:

    printf("\033[0;32;40mhello there\n");

    will print "hello there" in green.
    Here is a link which will be helpful:
    http://www.linuxfocus.org/English/Ma...ticle335.shtml

  4. #4
    Linux User
    Join Date
    Dec 2004
    Posts
    323
    In your currently blocked cross post I suggested to check the following:
    http://www.linuxforums.org/forum/topic-89.html

    Tech

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •