System() to string without temp file


I am trying to work out how to execute the system function and keep the results in a string without writing it to a temp file. Can anyone please help? Every example I have googled uses one??

(Also, what happens if the function I run requires admin rights to execute?)

closed account (Dy7SLyTq)
the correct way is not use system
ok. what should i use? popen()?
closed account (Dy7SLyTq)
what os r u using?
non specific. arch/ubuntu to start with.
closed account (Dy7SLyTq)
then there i think you can do something with ncurses but im not sure
looks interesting but is there a way without using curses? i would have assumed there was something in the standard libraries.

closed account (Dy7SLyTq)
no just system which is evil to begin with, but you cant really redirect output back into the program
why is system evil?
closed account (Dy7SLyTq)
many reasons. one) its really resource heavy
two) you dont know if the program your trying to run is the right one
three) its os dependent
closed account (Dy7SLyTq)
Thanks. I actually just found this and read it. Very informative!

The thing is, I am making something which is reliant on running third party tools.

I want to create a program with menus which can execute commands against virtualbox on a headless server. I know I could use the php client but I wanted to include some functions which aren't available using the GUI.
Last edited on
closed account (Dy7SLyTq)
ive never needed to use third party applications so i didnt even know about it until you mentioned it so idk if thats any good but you probably did research. i just know that system is horrible
thanks man.
Topic archived. No new replies allowed.