System() to string without temp file

Apr 2, 2013 at 8:12pm
Hey.

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?)

Cheers
Apr 2, 2013 at 8:27pm
closed account (Dy7SLyTq)
the correct way is not use system
Apr 2, 2013 at 8:30pm
ok. what should i use? popen()?
Apr 2, 2013 at 8:36pm
closed account (Dy7SLyTq)
what os r u using?
Apr 2, 2013 at 8:38pm
non specific. arch/ubuntu to start with.
Apr 2, 2013 at 8:39pm
closed account (Dy7SLyTq)
then there i think you can do something with ncurses but im not sure
Apr 2, 2013 at 8:50pm
looks interesting but is there a way without using curses? i would have assumed there was something in the standard libraries.

Apr 2, 2013 at 8:52pm
closed account (Dy7SLyTq)
no just system which is evil to begin with, but you cant really redirect output back into the program
Apr 2, 2013 at 8:53pm
why is system evil?
Apr 2, 2013 at 8:54pm
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
Apr 2, 2013 at 8:57pm
closed account (Dy7SLyTq)
http://www.cplusplus.com/forum/articles/11153/
Apr 2, 2013 at 8:59pm
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 Apr 2, 2013 at 9:02pm
Apr 2, 2013 at 9:05pm
Apr 2, 2013 at 9:08pm
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
Apr 2, 2013 at 9:14pm
thanks man.
Topic archived. No new replies allowed.