ANSI C: stdout in colors / sound / delay

  • Thread starter Olaf \El Blanco\
  • Start date
O

Olaf \El Blanco\

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!
 
V

Vladimir Oka

Olaf said:
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
 
N

Neroku

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top