On Sat, Apr 12, 2008 at 6:39 AM, Valnir <[EMAIL PROTECTED]> wrote:
> Hey guys.. hopefully someone still watches this list.. I need to be able to
>  read the output from a popen pipe. Can someone tell me how? Thanks!
>
>  Valnir
>  Head Coder
>  Legend of the Nobles
>  -----------------------------------
>  [EMAIL PROTECTED]
>  http://www.legendofthenobles.com
>  telnet://play.legendofthenobles.com:5400
>
>
>  --
>  ROM mailing list
>  [email protected]
>  Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
>

popen returns a standard i/o stream so you just read from it exactly
like a file! Make sure when you invoke it you use 'r'. eg

#include <stdio.h>
int main( void )
{   FILE *pipe;
    char c;
    if( ! ( pipe = popen("ls -l", "r") ) )
    { perror("ls -l");
      return;
    }

   while( ( c = fgetc(pipe) ) != EOF )
   printf("%c", c);
   return 0;
}


Davion
-- 
A MudBytes Administrator
http://www.mudbytes.net - A Code Repository
-- 
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom

Reply via email to