--- smsdaemon/util.cpp 2008/06/16 10:09:17 89 +++ smsdaemon/util.cpp 2008/06/19 14:47:52 107 @@ -298,11 +298,25 @@ return now; } - int my_system(const char* cmd) + int my_system(const char* cmd, std::string* response) { FILE* p; - if ((p = popen(cmd,"w")) == NULL) + if ((p = popen(cmd,"r")) == NULL) return (-1); + + if (response) + { + std::string output; + char buf[256]; + while(!feof(p)) + { + int len = fread(buf,1,255, p); + buf[len] = 0; + output += buf; + } + *response = output; + } + return (pclose(p)); }