1. re: [OT] POSIX stuff
- Posted by mistertrik at hotmail.com Apr 27, 2003
- 388 views
How stupid of me! I scrolled straight past a unistd.h function called pipe(). Nevermind, I think I can figure it out now... <slaps self in head> ===================================================== I don't need my eyes checked, I need my brain checked: Doc: "Yup, still there" Me: "I want a second opinion" .______<-------------------\__ / _____<--------------------__|=== ||_ <-------------------/ \__| Mr Trick
2. re: [OT] POSIX stuff
- Posted by mistertrik at hotmail.com Apr 27, 2003
- 385 views
>From: mistertrik at hotmail.com >How stupid of me! I scrolled straight past a unistd.h function called >pipe(). > >Nevermind, I think I can figure it out now... <slaps self in head> It seems I spoke too soon... Apologies for cluttering up a euphoria mailing list with C questions... I have created the pipe, and forked to get the two separate processes. How does one go about tying stdin to pipe read end in one process, and tying stdout to pipe write end in the other? Atm it just uses stdout = pipeend[1] and stdout = pipeend[0];, quite definitely good programming practice. On attempting to pipe ls to grep, a segmentation fault occured, but on attempting to pipe ls to pico, there was no error, and it worked fine. I am very confused... ===================================================== .______<-------------------\__ / _____<--------------------__|=== ||_ <-------------------/ \__| Mr Trick
3. re: [OT] POSIX stuff
- Posted by andy at systemzone.freeserve.co.uk Apr 27, 2003
- 405 views
I'm not infront on a UNIX box right now but the freopen function might be worth a look? Regards, Andy Cranston. At 04:08 AM 4/28/03 +1000, you wrote: > > >>From: mistertrik at hotmail.com >>How stupid of me! I scrolled straight past a unistd.h function called >>pipe(). >> >>Nevermind, I think I can figure it out now... <slaps self in head> > >It seems I spoke too soon... >Apologies for cluttering up a euphoria mailing list with C questions... > >I have created the pipe, and forked to get the two separate processes. >How does one go about tying stdin to pipe read end in one process, and tying >stdout to pipe write end in the other? >Atm it just uses stdout = pipeend[1] and stdout = pipeend[0];, quite >definitely good programming practice. > >On attempting to pipe ls to grep, a segmentation fault occured, but on >attempting to pipe ls to pico, there was no error, and it worked fine. > >I am very confused... >===================================================== >.______<-------------------\__ >/ _____<--------------------__|=== >||_ <-------------------/ >\__| Mr Trick > > > >TOPICA - Start your own email discussion group. FREE! > >
4. re: [OT] POSIX stuff
- Posted by mistertrik at hotmail.com Apr 28, 2003
- 411 views
Thanks andy. I used freopen to implement redirection ( > >> < >& >>& ). It won't work for piping, because freopen redirects a stream to a file. freopen( char* file, char* filemode, stream ) In my implementation I created a pipe(). The two ends of the pipe are file _handles_, not files. For that I thought you could use fdopen: stream = fdopen( int filehandle, char* mode); But it doesn't want to redirect stdout or stdin, the input process still outputs to screen, rather than to the output process. ===================================================== Mr Trick >From: andy at systemzone.freeserve.co.uk >Reply-To: EUforum at topica.com >To: EUforum <EUforum at topica.com> >Subject: re: [OT] POSIX stuff >Date: Sun, 27 Apr 2003 22:10:01 +0100 > > >I'm not infront on a UNIX box right now but the freopen function might be >worth a look? > >Regards, > >Andy Cranston. > >At 04:08 AM 4/28/03 +1000, you wrote: > > > > > >>From: mistertrik at hotmail.com > >>How stupid of me! I scrolled straight past a unistd.h function called > >>pipe(). > >> > >>Nevermind, I think I can figure it out now... <slaps self in head> > > > >It seems I spoke too soon... > >Apologies for cluttering up a euphoria mailing list with C questions... > > > >I have created the pipe, and forked to get the two separate processes. > >How does one go about tying stdin to pipe read end in one process, and >tying > >stdout to pipe write end in the other? > >Atm it just uses stdout = pipeend[1] and stdout = pipeend[0];, quite > >definitely good programming practice. > > > >On attempting to pipe ls to grep, a segmentation fault occured, but on > >attempting to pipe ls to pico, there was no error, and it worked fine. > > > >I am very confused... > >===================================================== > >.______<-------------------\__ > >/ _____<--------------------__|=== > >||_ <-------------------/ > >\__| Mr Trick > > > > > >TOPICA - Start your own email discussion group. FREE! > > > > > > >TOPICA - Start your own email discussion group. FREE! > >