int main()
{
int i = 0;
char buf;
int dev_fd;
dev_fd = open("/dev/beep",O_RDWR | O_NONBLOCK);
if ( dev_fd == -1 ) {
printf("Cann't open file /dev/beep\n");
exit(1);
}
while(1)
{
getchar();
ioctl (dev_fd, BEEP_START_CMD,0);
read(dev_fd,&buf,sizeof(buf));
printf("The value of the buzzer:%d\n",buf);
getchar();
ioctl (dev_fd, BEEP_STOP_CMD,0);
read(dev_fd,&buf,sizeof(buf));
printf("The value of the buzzer:%d\n",buf);
}
return 0;
}