How do I make my program beep.

News system news at ism780c.isc.com
Fri Jun 8 05:34:29 AEST 1990


In article <3168 at goanna.cs.rmit.oz.au> ok at goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
>(2) #define mybeep putchar('\7')
>    has a fairly serious defect:  output to stdout is often buffered or
>    line-buffered, and '\7' is not a complete record.  You need
>	#define mybeep (putchar('\7'), fflush(stdout))
>

putchar('\7') has an even more serious defect.  The reason for beeping is
to notify the user of the program of something while the program is
*running*. There is no guarantee that sending a '\7' to stdout will cause an
beep.  Stdout may well be a diskfile.  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.

    Marv Rubinstein



More information about the Comp.lang.c mailing list