[LCP] Redirecting File stream to a char*?

Robert Wuest rwuest at wuest.org
Fri Jun 27 11:57:14 EST 2008


You can do it with pipe() (do man 2 pipe).  You will also need to
understand fileno() and fdopen().

An alternative is to use a fifo (man mknod and look at the 'p' option),
which is a named pipe you can fopen().  You can read about them with man
fifo.

Robert

On Thu, 2008-06-26 at 20:57 -0400, Leonard Smith wrote:
> I need to use a function that is included from a shared library. The
> function uses fprint to output errors to stderr or the file pointer
> that is passed with the function call. I want to capture the output to
> a char* and not be outputed to stdout. I've tried different things,
> like using setbuf, but it hasn't been quite right.
> 
> Is there a way to do this?
> 
> Thanks
> Len
> 
> _______________________________________________
> This is the Linux C Programming List
> :  http://lists.linux.org.au/listinfo/linuxcprogramming List
> 




More information about the linuxCprogramming mailing list