Capturing program feedback... (not sure what to call it)
i'm working on a little project in kdevelop in c++
i need to know how to get the feedback from a system command to where i can use it. i'm not really sure what terminology i should be using here, forgive me. what i mean is like if i ran said this: system(/etc/rc.d/init.d/httpd start); i need some way to get what it the program's output was in terminal, for example, if it couldn't do this for some reason like 'file not found' how could i get that file not found message and put it in, um..., a QString or something? So like i could do something like this: feedbackBox->append(where-ever-i-get-the-feedback-from()); sorry if im unclear on what i want, i cant really help it... any information on this subject line would be useful thx in advance, llama |
It sounds like you might find popen() useful. You use it, and then do traditional file I/O routines to read the command's output.
man popen for more details of course... EDIT: while not strictly C++, it will still work. I don't know if there is a C++ equivalent (that would create an iostream class for instance). |
that works and returns what i want but it gives it as a const char and i need it in a QString for the widget im using to accept it. any ideas on how to convert a char into a QString???
|
Sorry, I can't help there. I've never done any programming with the Qt library.
I would find it hard to believe that there's no overloaded '=' operator for a QString though. Something like: (QString) = (char *) or (QString) += (char *). If they don't exist, my impression of the Qt library just dropped a couple notches... |
All times are GMT -5. The time now is 04:56 AM. |