In my program (main.c) I fork a process and then I need to send data via pipe to child process. After execl system call child process continues its life in process.c file. With setting standard input of that child to file descriptor of its parent I try to send data from parent process to child process. But child process cannot reach any input and I couldn't understand that why this problem occurs. Many thanks in advance.
main.c
#define PIPE(fd) socketpair(AF_UNIX, SOCK_STREAM, PF_UNIX, fd)
...
char* data="data";
int fd[2];
PIPE(fd);
write(fd[0],data,sizeof(data));
if(fork()==0){
dup2(fd[0],0);
close(fd[0]);
close(fd[1]);
execl("process","process",x,y,0);}
process.c
...
char* data;
read(0,data,10);
printf("%s\n",data);