当前位置: 技术问答>linux和unix
运行错误。。找不到了。。唉。。
来源: 互联网 发布时间:2016-09-29
本文导语: #include #include #include #include #include #include #include #include int main() { pid_t pid; pid=fork( ); int j; switch (pid) { case -1: perror("fork failed"); ...
#include
#include
#include
#include
#include
#include
#include
#include
int main()
{ pid_t pid;
pid=fork( );
int j;
switch (pid)
{
case -1:
perror("fork failed");
exit(0);
case 0:
voice();
exit(1);
default:
choice();
exit(1);
}
}
int pic1()
{ printf (" %%%%%%% n");
printf (" %%/ /%, n");
printf (" %%%c -- J/%%, n");
printf (" %. %%%%/ d b %%% n");
printf (" `%%. __ %%% _ |%%% n");
printf (" `%% .-' '"~--"`%%%%%(=_Y_=)%%%' ~~~ n");
printf (" // .' `. `%%%%`7/%%%'____ n");
printf (" (( / ; `%%%%%%%'____))) n");
printf (" `.`--' ,' _,`-._____`-, n");
return 0;
};
int pic2()
{
printf(" ,%%%%%%% n");
printf(" ,%%/%%%%/% n");
printf(" %%%c "" J/%% n");
printf(" %. %%%%/ d b %%% n");
printf(" `%%. __ %%%% _ |%%% n");
printf(" `%% .-' `"~--"`%%%%(=_Y_=)%%' ~~~ n");
printf(" // . ' `. `%%%%`7/%%%' n");
printf(" (( / ; `%%%%%%%' n");
printf(" | / | | | * * n");
printf(" | / | | | |* * n");
printf(" |_ * |__ * |__* |_* n");
return 1;
};
int voice(int grac, char **argv)
{
int console_fd;
int i;
int s[ ]={523,587,659,523,523,587,659,523,659,698,784,659,698,784,
784,880,784,698,659,523,784,880,784,698,659,523,659,392,523,659,392,523};
int len[ ]={500,500,500,500,500,500,500,500,500,500,500,750,500,500,500,250,250,250,250,500,500,250,250,250,250,500,500,500,500,500,500,500,500};
if((console_fd=open("/dev/console",O_WRONLY))==-1)
{
fprintf(stderr,"failed to open.n");
perror("open");
exit(1);
}
for(i=0;i=0;j--)
{
if (l==k)
{
l= pic1();
pic1();
}
else
{
l= pic2();
pic2();
}
//switch
sleep(1);
}
// k=k+1;
// k%2;
//for
};
我运行的时候有错误啊。。可是不知道哪里错了。。大家帮我看看呗~~~~~~~~
[root@localhost root]# cc -o child child.c
child.c:30:19: warning: unknown escape sequence: '40'
child.c:31:19: warning: unknown escape sequence 'c'
child.c: In function `pic1':
child.c:34: parse error before '~' token
child.c: In function `pic2':
child.c:44: stray '343' in program
child.c:44: stray '200' in program
child.c:44: stray '200' in program
child.c:45: stray '343' in program
child.c:45: stray '200' in program
child.c:45: stray '200' in program
child.c:45:12: warning: unknown escape sequence 'c'
child.c:46: stray '343' in program
child.c:46: stray '200' in program
child.c:46: stray '200' in program
child.c:47: stray '343' in program
child.c:47: stray '200' in program
child.c:47: stray '200' in program
child.c:48: stray '343' in program
child.c:48: stray '200' in program
child.c:48: stray '200' in program
child.c:48: parse error before '~' token
child.c:49: stray '343' in program
child.c:49: stray '200' in program
child.c:49: stray '200' in program
child.c:50: stray '343' in program
child.c:50: stray '200' in program
child.c:50: stray '200' in program
child.c:51: stray '343' in program
child.c:51: stray '200' in program
child.c:51: stray '200' in program
child.c: At top level:
child.c:88: warning: type mismatch with previous implicit declaration
child.c:23: warning: previous implicit declaration of `choice'
child.c:88: warning: `choice' was previously implicitly declared to return `int'[root@localhost root]#
#include
#include
#include
#include
#include
#include
#include
int main()
{ pid_t pid;
pid=fork( );
int j;
switch (pid)
{
case -1:
perror("fork failed");
exit(0);
case 0:
voice();
exit(1);
default:
choice();
exit(1);
}
}
int pic1()
{ printf (" %%%%%%% n");
printf (" %%/ /%, n");
printf (" %%%c -- J/%%, n");
printf (" %. %%%%/ d b %%% n");
printf (" `%%. __ %%% _ |%%% n");
printf (" `%% .-' '"~--"`%%%%%(=_Y_=)%%%' ~~~ n");
printf (" // .' `. `%%%%`7/%%%'____ n");
printf (" (( / ; `%%%%%%%'____))) n");
printf (" `.`--' ,' _,`-._____`-, n");
return 0;
};
int pic2()
{
printf(" ,%%%%%%% n");
printf(" ,%%/%%%%/% n");
printf(" %%%c "" J/%% n");
printf(" %. %%%%/ d b %%% n");
printf(" `%%. __ %%%% _ |%%% n");
printf(" `%% .-' `"~--"`%%%%(=_Y_=)%%' ~~~ n");
printf(" // . ' `. `%%%%`7/%%%' n");
printf(" (( / ; `%%%%%%%' n");
printf(" | / | | | * * n");
printf(" | / | | | |* * n");
printf(" |_ * |__ * |__* |_* n");
return 1;
};
int voice(int grac, char **argv)
{
int console_fd;
int i;
int s[ ]={523,587,659,523,523,587,659,523,659,698,784,659,698,784,
784,880,784,698,659,523,784,880,784,698,659,523,659,392,523,659,392,523};
int len[ ]={500,500,500,500,500,500,500,500,500,500,500,750,500,500,500,250,250,250,250,500,500,250,250,250,250,500,500,500,500,500,500,500,500};
if((console_fd=open("/dev/console",O_WRONLY))==-1)
{
fprintf(stderr,"failed to open.n");
perror("open");
exit(1);
}
for(i=0;i=0;j--)
{
if (l==k)
{
l= pic1();
pic1();
}
else
{
l= pic2();
pic2();
}
//switch
sleep(1);
}
// k=k+1;
// k%2;
//for
};
我运行的时候有错误啊。。可是不知道哪里错了。。大家帮我看看呗~~~~~~~~
[root@localhost root]# cc -o child child.c
child.c:30:19: warning: unknown escape sequence: '40'
child.c:31:19: warning: unknown escape sequence 'c'
child.c: In function `pic1':
child.c:34: parse error before '~' token
child.c: In function `pic2':
child.c:44: stray '343' in program
child.c:44: stray '200' in program
child.c:44: stray '200' in program
child.c:45: stray '343' in program
child.c:45: stray '200' in program
child.c:45: stray '200' in program
child.c:45:12: warning: unknown escape sequence 'c'
child.c:46: stray '343' in program
child.c:46: stray '200' in program
child.c:46: stray '200' in program
child.c:47: stray '343' in program
child.c:47: stray '200' in program
child.c:47: stray '200' in program
child.c:48: stray '343' in program
child.c:48: stray '200' in program
child.c:48: stray '200' in program
child.c:48: parse error before '~' token
child.c:49: stray '343' in program
child.c:49: stray '200' in program
child.c:49: stray '200' in program
child.c:50: stray '343' in program
child.c:50: stray '200' in program
child.c:50: stray '200' in program
child.c:51: stray '343' in program
child.c:51: stray '200' in program
child.c:51: stray '200' in program
child.c: At top level:
child.c:88: warning: type mismatch with previous implicit declaration
child.c:23: warning: previous implicit declaration of `choice'
child.c:88: warning: `choice' was previously implicitly declared to return `int'[root@localhost root]#
|
直接从网上粘贴下来的吧
很多字符都不识别
很多字符都不识别