All pastes #18185 Raw Edit

linuxbeep

public cpp v1 · immutable
#18185 ·published 2005-07-20 21:28 UTC
rendered paste body
#include <errno.h>#include <fcntl.h>#include <getopt.h>#include <linux/kd.h>#include <math.h>#include <netdb.h>#include <netinet/in.h>#include <netinet/tcp.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/ioctl.h>#include <sys/socket.h>#include <sys/stat.h>#include <sys/types.h>#include <unistd.h>using namespace std;int main(){int fd;int tone;double freq;fd = open("/dev/tty1", O_RDONLY | O_NOCTTY);/*tone = 60;freq = 13.75f * pow(2, tone / 12.0f);*/freq = 10000f;while(true){ioctl(fd, KIOCSOUND, (int) (1190000 / freq));}return 0;}