How do I make my program beep.

Karl Heuer karl at haddock.ima.isc.com
Tue Jun 12 02:19:52 AEST 1990


In article <90061017513753 at masnet.uucp> simon.ewins at f664.n250.z1.fidonet.org (simon ewins) writes:
>> In article <3168 at goanna.cs.rmit.oz.au> ok at goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
>>The output must be directed to a device that will make a noise that the user
>>can hear.  I know of no portable way to do this.

Of course not; there's no guarantee that there's *any* beepable device
accessible to the current program.

>How about...  cprintf("\a");

Not portable.  This is some vendor-specific hack.
(Also the "\a" isn't portable to pre-ANSI, but this can be worked around.)

>or  fprintf(stderr,"\a");

Using stderr is probably best.  The user could have redirected the error
output away from the terminal, but if so, it's very possible that he doesn't
want the beep on the terminal either.

Karl W. Z. Heuer (karl at ima.ima.isc.com or harvard!ima!karl), The Walking Lint



More information about the Comp.lang.c mailing list