***********我又来求指点了*********
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<errno.h>
#include<sys/types.h>
int main(int argc, char* argv[])
{
int i = 0;
pid_t pid = -1;
fprintf(stdout, "parent pid[%d], i[%d]\n", getpid(), i);
if((pid = vfork()) < 0)
{
fprintf(stderr, "fork failed!! errorno = %d\n", errno);
return 0;
}
else if(pid > 0)
{
fprintf(stdout, "after fork, parent pid[%d], i[%d]\n", getpid(), i);
}
else
{
system("find . -type f");
}
fprintf(stdout, "process end. pid[%d], i[%d]\n", getpid(), i);
return 0;
}运行结果:
parent pid[20000], i[0]
./core.17552
./libshow.a
./dup2.c
./csdn.c
./main
./base/baseMath.o
./base/baseMath.c
./base/libbaseMath.a
./base/libbaseMath.so
./base/baseMath.h
./test.cpp
./stat.c
./power.c
./tag.c
./libshow.so
./unlink
./unlink.c
./book.c
./show.o
./a.bat
./show.c
./reservword.c
./fileop.c
./code.c
process end. pid[20001], i[0]
after fork, parent pid[20000], i[0]
process end. pid[20000], i[0]
Segmentation fault (core dumped)为什么最后core了。。。。?!
...全文
相关推荐
求大佬指点指点,SQL基础培训练习题以及解题思路
求大佬指点指点,SQL基础培训练习题以及解题思路
(地主源代码)求解! 做的不够好,求大神指点
做的不够好,求大神指点
ThinkPad指点杆(小红点)驱动中文版
TP4TABLE.DAT:这可能是驱动程序的数据文件,存储了关于指点杆操作的各种参数和配置信息。4.
(15/15)BT4中文版(790M带spoonwep2\spoonwpa\minidwep-gtk\feedingbottle)
*********真不容易,一次只能传60M,不过终于传完了***********790M的BT4中文版(带spoonwep2、spoonwpa、minidwep-gtk、feedingbottle)
菱形,空心菱形,带框菱形的JAVA实现
8 * *** ***** ******* ********* *********** ************* ***************


