Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Dec 2009 15:33:27 +0000
From:      Anton Shterenlikht <mexas@bristol.ac.uk>
To:        Polytropon <freebsd@edvax.de>
Cc:        Anton Shterenlikht <mexas@bristol.ac.uk>, freebsd-questions@freebsd.org
Subject:   Re: example c program that does "beep"
Message-ID:  <20091226153327.GA9918@mech-anton242.men.bris.ac.uk>
In-Reply-To: <20091225204914.2a532df3.freebsd@edvax.de>
References:  <20091225185826.GA82073@mech-cluster241.men.bris.ac.uk> <20091225204914.2a532df3.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Dec 25, 2009 at 08:49:14PM +0100, Polytropon wrote:
> On Fri, 25 Dec 2009 18:58:26 +0000, Anton Shterenlikht <mexas@bristol.ac.uk> wrote:
> > How can I get a beep from c?
> > I looked at curses and syscons.c, but
> > still not clear.
> 
> If you want to use NCURSES / CURSES, it's a bit complicated.
> 
> Otherwise, just output %c (the character) 0x07, BEL, which
> generates an audible bell, or beep.
> 
> 
> *** text/plain attachement has been stripped *** RETRY ***
> 
> /* beepflash.c
>  * -----------
>  * cc -Wall -lcurses -o beepflash beepflash.c
>  *
>  */
> 
> #include <stdio.h>
> #include <ncurses.h>
> 
> int main(int argc, char *argv[])
> {
> 	initscr();
> 	cbreak();
> 	noecho();
> 	nonl();
> 	intrflush(stdscr, FALSE);
> 	keypad(stdscr, TRUE);
> 	start_color();
> 
> 	printf("beep: %d\n", beep());
> 	fflush(stdout);
> 
> 	printf("flash: %d\n", flash());
> 	fflush(stdout);
> 
> 	return 0;
> }

Instead of a beep and a flash I get:

beep: 0./beepflash
       flash: 0
               HAMOR>

on the console.

Hamor> is a tcsh prompt.

Maybe something is wrong with my installation?
Or maybe I'm too stupid and missed something
obvious?

thank you

-- 
Anton Shterenlikht
Room 2.6, Queen's Building
Mech Eng Dept
Bristol University
University Walk, Bristol BS8 1TR, UK
Tel: +44 (0)117 331 5944
Fax: +44 (0)117 929 4423



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091226153327.GA9918>