FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

Storing system calls in C

 


Liu
Is there any way to store the output of system calls in C?

I.e. piping the output of the Unix command system("ls") into a string which will be used later in the program.

The only method I can think of right now is system("ls>temp"), read contents of temp, system("rm temp -f"). If you have better suggestions, please give me some.

Gratitude for help.
Liu
I just discovered the answer a couple days ago, a friend told me a way to do it, for those interested in the answer you can use popen.
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.