Pipes se Linux...
Harris Kosmidhs
hkosmidi at alexandros.csd.auth.gr
Wed May 14 12:32:33 EEST 1997
Re paidia oi sunarthsh pipe() exei diaforetiko implementation se Linux.
To parakato programma trexei kanonika se AIX, eno sto Linux mou papala..
Mporei kaneis na boh8hsei?
Einai problhma tou Linux h tou programmatos?
#include <stdio.h>
#include <unistd.h>
int main()
{
int n,fd1[2],fd2[2],pid;
char buff[10],buff1[101];
if(pipe(fd1)<0)
perror("Error in 1 pipe");;
if(pipe(fd2)<0)
perror("Error in 2 pipe");
if((pid=fork())==0)
{
if(dup2(fd1[0],0)<0)
perror("Error in 1 dup\n");
if(dup2(fd2[1],1)<0)
perror("Error in 2 dup\n");;
close(fd1[1]);close(fd2[0]);
execl("/bin/bc\0","/bin/bc\0",NULL);
}
if((n=read(fd2[0],buff1,100))<0) /* Auto einai gia ta eisagvgika*/
perror("Erro readin"); /*sxolia tou bc*/
if(write(fd1[1],"10+10\n",6)<0)
perror("Error writting");
if((n=read(fd2[0],buff,3))<0)
perror("Error in reading");
printf("10+10=%s\n",buff);
return 0;
}
#############################
# Kosmidhs Harris #
# hkosmidi at aix.meng.auth.gr #
#############################
--
====================================================================
Gia na mathete pos na xrisimopoiite ton majordomo, stilte e-mail
sto "majordomo at argeas.argos.hol.gr" me 1 grammi sto keimeno: help
Ta archives tis listas einai sto http://www.argos.hol.gr/lists
Gia opoiodipote problima stilte e-mail ston owner-linux-greek-users
====================================================================
More information about the Linux-greek-users
mailing list