这个程序能同步么
小神流川 2010-09-19 11:17:17 #include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <linux/kd.h>
main()
{
pid_t pc,pr;
pc=fork();
if(pc<0)
{
printf("erorr ocurred!");
}
else if(!pc)
{
int console_fd;
int i;
int s[]={659,523,578,659,523,523,523,784,698,659,578,659,523,578,659,578,578,578,659,523,578,659,523,523,523,784,698,659,578,659,523,578,659,578,578,578,659,578,578,659,523,523,440,523,523,440,392,659,698,784,784,578,523,659,578,659,578,578,659,523,440,440,523,523,440,392,330,659,698,784,784,578,523,659,578,659,578,659,523,440,440,523,523,440,392,659,698,784,784,578,578,578,659,578,659,578,659,578,523,440,523,523,440,392,330,578,578,784,784,578,578,578,659,578,523,523,523,523,659,784,880,880,880,880,880,880,784,659,578,523,523,523,523,523,523,523,659,784,880,880,880,880,880,880,880,784,659,659,578,659,659,578,523,523,523,578,659,578,523,698,698,659,698,523,659,698,659,578,497,578,578,659,578,497,523,523,523,578,659,578,523,698,698,659,698,523,659,698,659,578,497,578,578,659,578,497,523};
int len[]={250,250,250,125,125,250,125,125,125,125,125,250,250,250,125,125,500,500,250,250,250,125,125,250,125,125,125,125,125,250,250,250,125,125,500,500,250,125,125,250,125,125,250,125,170,170,170,250,125,250,250,250,125,250,250,250,125,125,250,125,125,250,125,125,125,125,125,250,125,250,250,250,125,250,250,250,125,250,125,125,250,125,170,170,170,250,125,250,125,125,250,125,250,250,250,125,250,125,125,250,125,125,125,125,125,250,125,250,125,125,250,125,250,125,125,125,250,125,250,250,500,125,125,250,125,125,250,250,500,250,250,125,125,125,125,125,125,125,125,500,250,250,250,125,125,250,125,125,250,250,125,125,250,125,250,125,125,125,250,125,250,125,250,250,125,250,125,250,250,125,250,125,250,250,250,125,250,125,125,125,250,125,250,125,250,250,125,250,125,250,250,125,250,125,250,250,500};
if((console_fd=open("/dev/console",O_WRONLY))==-1)
{
fprintf(stderr,"Failed to open console.\n");
perror("open");
exit(1);
}
for(i=0;i<194;i++)
{
int magical_fairy_number=1190000/s[i];
ioctl(console_fd,KIOCSOUND,magical_fairy_number);
usleep(1000*len[i]);
ioctl(console_fd,KIOCSOUND,0);
usleep(1000*50);
}
}
else
{
printf("Oh oh oh oh oh oh \n ");
usleep(1000*12000) ;
printf("Give me freedom, give me fire\n");
usleep(1000*4000) ;
printf("give me reason take me higher see the champions take the field now \n");
usleep(1000*4000);
printf("giev me reason take me higher see the champions take the field now\n ");
usleep(1000*4000);
printf("you de-fine us make us feel proud in the streets are\n ");
usleep(1000*3000);
printf("exaliftin as we lose our inhibition \n ");
usleep(1000*1000);
printf("Celebration its around us every nations all around us \n");
usleep(1000*4000);
printf("Singin for-ever young singin songs underneath that sun \n ");
usleep(1000*4000);
printf("Lets re-joice in the beautiful game and to songs underneath that sun\n ");
usleep(1000*4000);
printf("Lets re-joice in the beautiful game and to-gether at the end of the day\n ");
usleep(1000*4000);
printf("we all say wwwhen i get older i will be stronger\n ");
usleep(1000*2000);
printf("They'll call me freedom just like a wavin'flag\n ");
usleep(1000*2000);
printf("when i get older i will be stronger.They'll call me freedom just like a wavin'flag\n");
}
}
这个程序。。能唱一句。。然后放一句歌词么???大家谁能告诉我啊。。。。