|
发表于 2009-1-8 14:17:31
|
显示全部楼层
Post by hstking;1935587
我初学,不知道对不对啊。
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/waitlh>
main()
{
sysytem("echo "HI it ....." >> /syslog /* 我觉得用shell 方便点,就不用fopen什么的了。*/
if((fork()==0)
printf("yes i feel very good\n");
else
{
wait();
printf("Ops ,No one in the chat room\n")
}
}
当然不对了~
父进程向文件/syslog中写入:Hi, it is a lovely day today.
你是第一行就写的~那时还没产生父子关系~ |
|