Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sys/ioctl.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <linux/kd.h>
- #include <fcntl.h>
- #include <unistd.h>
- #include <stdio.h>
- int main(int argc, char* argv[]) {
- int fd = open("/dev/console", O_WRONLY);
- if (fd < 0) {
- printf("can't open console\n");
- return fd;
- }
- if (geteuid()) {
- printf("use:\n\tsudo %s\n", argv[0]);
- return -1;
- }
- for (int t=0;;t++) {
- int val = (t*(((t>>12)|(t>>8))&(63&(t>>4))));
- printf("%d\n", val);
- ioctl(fd, KIOCSOUND, val);
- usleep(25000);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement