#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
int main()
{
int fd = open("data",O_WRONLY | O_CREAT, 0777);
int pid = -1;
int stat;
if(fd == -1)
{
printf("文件打开失败\n");
}
if((pid = fork()) > 0)
{
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
int main()
{
int fd = open("data",O_WRONLY | O_CREAT, 0777);
int pid = -1;
int stat;
if(fd == -1)
{
printf("文件打开失败\n");
}
if((pid = fork()) > 0)
{
write(fd,"12345", strlen("12345"));