[LatinaLUG] C++: funzione beep

Davide "DeMoN3" Angelini demon3rock@gmail.com
Sab 29 Set 2007 16:24:10 CEST


2007/9/29, Enrico Bassetti <enrico.bassetti@q4q5.it>:
> Il giorno sab, 29/09/2007 alle 15.08 +0200, Davide "DeMoN3" Angelini ha
> scritto:
>
> >
> > For Linux
> >
> > Note: you need write access to /dev/tty10 or you have to run this
> > program as root. This could be a security hole. Search on Google, if
> > you want a Linux-module with user access for the beep-function.
> >
> > #include <stdlib.h>
> > #include <fcntl.h>
> > #include <linux/kd.h>
> >
> > int main(int argc, char *argv[])
> > {
> >     int fd = open("/dev/tty10", O_RDONLY);
> >     if (fd == -1 || argc != 3) return -1;
> >     return ioctl(fd, KDMKTONE, (atoi(argv[2])<<16)+(1193180/atoi(argv[1])));
> > }
> >
> > Copy this to a file beep.c and compile it like this:
> >
> > cc beep.c -o beep
> > strip beep
>
> ma se vi serviva un programmino esisteva già, basta fare apt-get install beep....
>
> Enrico
>
A lui a quanto sembra gli serviva una funzione da integrare nei programmi C++


Maggiori informazioni sulla lista latina