int fd_in, fd_out; /* file descriptor for fifo */ pid_t pid; /* prozess id */ FILE * fifoout; FILE * fifoin; char buf_out[256]; char buf_in[256]; pid = getpid(); sprintf(buf_out,"/tmp/LEX%d",pid); sprintf(buf_in,"/tmp/LEX%d",pid); i = mkfifo(buf_out, 0600); if ( i < 0 ) fprintf(stderr,"mkfifo %s failed %d\n",buf_out,errno); /* j = mkfifo(buf_in, 0600); if ( j < 0 ) fprintf(stderr,"mkfifo %s failed %d\n",buf_out,errno); */ fd_out = open(buf_out,O_RDWR | O_NDELAY); if ( fd_out < 0 ) fprintf(stderr,"open %s failed %d\n",buf_out,errno); fd_in = open(buf_out,O_RDONLY ); if ( fd_in < 0 ) fprintf(stderr,"open %s failed %d\n",buf_in,errno); fifoout = fdopen(fd_out,"a"); if (!fifoout) fprintf(stderr,"fdopen write failed %d\n",errno); fifoin = fdopen(fd_in,"r"); if (!fifoin) fprintf(stderr,"fdopen read failed %d\n",errno); and use freopen to assign stdout to fifoout Xavier Amado wrote:
I would need to execute a program (using g_spawn_async_with_pipes) and pass it's output to a second process. I'm not sure how to use the std_output in the above function though. Can anyone give me a simple example to do something like, for example, ls | grep root Thanks in advance. Regards, Xavier _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list gnome org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
-- R=I+S Rapp Informatik Systeme GmbH Rosenbühlstr. 24 D-89182 Bernstadt Tel: +49 (0)7348-7755 Fax: +49 (0)7348-6086 E-MAIL mailto: guenther rapp-informatik de WEB www.rapp-informatik.de
Attachment:
guenther.vcf
Description: Card for günther