#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
int main()
{
int fd=open("trialfile", O_CREAT|O_TRUNC|O_WRONLY, 0664);
write(fd,"hello from future father\n", sizeof("hello from future father\n"));
/*write(fd,"hello from future father\n", 30);*/
int ret_val=fork();
if(ret_val==-1)
return 1;
if(ret_val==0)
{
write(fd, "hello from child\n", sizeof("hello from child\n"));
/*write(fd, "hello from child\n", 30);*/
return 0;
}
else
{
write(fd, "hello from father\n", sizeof("hello from father\n"));
/*write(fd, "hello from father\n", 30);*/
return 0;
}
}