Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!xylogics!bu.edu!mirror!necntc!necssd!harrison From: harrison@necssd.NEC.COM (Mark Harrison) Newsgroups: comp.lang.c Subject: Re: How do I make my program beep. Message-ID: <361@necssd.NEC.COM> Date: 1 Jun 90 16:44:57 GMT References: <3472@umn-d-ub.D.UMN.EDU> <1990May27.000808.13551@utzoo.uucp> Organization: NEC America Inc. SSD, Irving, TX Lines: 34 In article <1990May27.000808.13551@utzoo.uucp>, henry@utzoo.uucp (Henry Spencer) writes: > In article <3472@umn-d-ub.D.UMN.EDU> halam2@umn-d-ub.D.UMN.EDU (Haseen Alam) writes: > > The K&R says that '\a' is an alert (audible bell), but how do I use it to > > make my program beep? All my attemps were vain!! > On what machine? You should ask this on a machine-specific newsgroup, like > say comp.sys.ibm.pc.programmer. How you get a beep is *highly* hardware- > dependent. My Sun-3/180 can't beep at all (although most of the terminals > attached to it can). I think Haseen was asking why the program main() { printf("hello world\a\n"); } prints "hello worlda" instead of "hello world" and then beeping. The '\a' alarm sequence is a new feature. Old fashioned compilers (read: most Unix compilers) don't support this, but on ascii machines, you can encode an octal seven (the "bel" character) to do the same thing: Of course your terminal/computer has to have the beeping hardware to make the noise. main() { printf("hello world\7\n"); } -- Mark Harrison harrison@necssd.NEC.COM (214)518-5050 {necntc, cs.utexas.edu}!necssd!harrison standard disclaimers apply...