[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Calling process with pipes
- From: günther <guenther rapp-informatik de>
- To: Xavier Amado <xavier blackbloodstudios com>,gtk-app-devel-list gnome org
- Subject: Re: Calling process with pipes
- Date: Mon, 17 Feb 2003 13:00:37 +0100
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
begin:vcard
n:Rapp;Günther
tel;fax:+49 (0)7348-6086
tel;work:+49 (0)7348-7755
x-mozilla-html:TRUE
url:www.rapp-informatik.de
org:R=I+S;Rapp Informatik Systeme GmbH
adr:;;Rosenbühlstr. 24;D-89182 Bernstadt;Germany;;
version:2.1
email;internet:guenther@rapp-informatik.de
x-mozilla-cpt:;0
fn:Günther Rapp
end:vcard
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]