thanks guys.
zugzwang: yes i am aware it is not portable, but if so i would have requested something like that. after all in windows i would have the C-Beep() method in windows.h and i could write me a wrapper or something.
Conclusion:
here is what i did: i first made the code compiling with two small changes, here the complete code.
PHP Code:
#include <iostream>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/kd.h>
int main(int argc, char** argv){
int freq = 2000; // freq in hz
int len = 1000; // len in ms
int fd = open("/dev/console", O_WRONLY);
ioctl(fd, KIOCSOUND, (int)(1193180/freq));
usleep(1000*len);
ioctl(fd, KIOCSOUND, 0);
close(fd);
}
Then, after wondering why i did not head any sound, fetched me the source of this beep package. I then found out the program would need sudo so that i would be able to hear a sound. which is not appropriate in my case.
well, so i now changed my program to use the external program (system installed) "beep" instead, overgiving it the length and pitch on commandline.
question solved, case closed
Bookmarks