ANSI C: stdout in colors / sound / delay

Discussion in 'C Programming' started by Olaf \El Blanco\, May 3, 2006.

  1. I am working with gcc.
    I would like to know:
    * How can I put the stdout in differents colors.
    (textcolor/background)
    * I need different frequencies in sounds, and I only know the famous
    printf ("\a");
    * I need a function like Pascal delay(x)

    Thank you!
     
    Olaf \El Blanco\, May 3, 2006
    #1
    1. Advertising

  2. Olaf \El Blanco\

    Vladimir Oka Guest

    Olaf El Blanco wrote:
    > I am working with gcc.
    > I would like to know:
    > * How can I put the stdout in differents colors.
    > (textcolor/background)
    > * I need different frequencies in sounds, and I only know the famous
    > printf ("\a");
    > * I need a function like Pascal delay(x)


    Standard C will not help you here.

    Depending on your terminal/output device you may be able to colorise
    output using ANSI (am I right they're called that?) escape codes, which
    you can emit using <stdio.h> functions. You'll have to look elsewhere
    for what exactly is available.

    Sounds will probably depend even more heavily on your particular OS, so
    look for groups dealing with it.

    Pretty much the same applies for timing. The only timer available in
    standard C is from <time.h> and it only gives you the number of clock
    ticks since your program started, but these may be affected by
    multitasking and other OSy stuff.

    HTH
     
    Vladimir Oka, May 3, 2006
    #2
    1. Advertising

  3. Olaf \El Blanco\

    Neroku Guest

    Olaf "El Blanco" ha escrito:

    > I am working with gcc.
    > I would like to know:
    > * How can I put the stdout in differents colors.
    > (textcolor/background)


    Standard C has nothing useful for you. You have to use external
    libraries, it depends on the OS, in a UNIX-like system search for
    curses.

    > * I need a function like Pascal delay(x)


    This is also system dependent, on UNIX systems there are two functions
    called sleep() and usleep()

    All these things are off-topic here, you should ask in
    comp.unix.programmer
     
    Neroku, May 3, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    499
  2. AAaron123

    TreeNode colors come from anchor colors

    AAaron123, Aug 7, 2008, in forum: ASP .Net
    Replies:
    1
    Views:
    555
    darrel
    Aug 7, 2008
  3. ZelluX
    Replies:
    3
    Views:
    1,923
    Peter Otten
    Dec 1, 2008
  4. James Edward Gray II

    [ANN] HighLine 0.3.0 -- Now with ANSI colors!

    James Edward Gray II, May 4, 2005, in forum: Ruby
    Replies:
    0
    Views:
    114
    James Edward Gray II
    May 4, 2005
  5. Sandman

    ANSI colors and the space they take.

    Sandman, Dec 31, 2003, in forum: Perl Misc
    Replies:
    14
    Views:
    703
    Michele Dondi
    Jan 12, 2004
Loading...

Share This Page