-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Ryan Byrd wrote:
| So, in C, is there a way to capture the stdout from a function?
|
| I have FunctionX which printfs a bunch of stuff. I'd like to capture
that stuff
| into a string without it printing and do a bunch of modifications to
it before
| printing.
|
| Did that make sense? Any ideas how I can do that?
|
| MRB

possibly:

~ * fork
~ * connect the stdout of the child process to stdin of the main process
~ * have the main process collect stdin into a string
~ * execute the method in the child process
~ * the child process outputs some terminator string
~ * the main process recognizes that terminator and stops collecting
~ * child process terminates
~ * parent process goes happily on its way with the new data

?

Jacob

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAED8e/PO7QochUiQRAta5AKDVqRwvV3qS30U4gi6MAz01yDUh/gCgzfbb
VX1L+WB9pEokhglSvGhmuI8=
=FsTU
-----END PGP SIGNATURE-----


____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to