Created
December 2, 2019 14:09
-
-
Save varvaruc/108d915fe8bc63831bac43ca4172b5cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string HttpServer::getStdoutFromCmd(std::string cmd) | |
{ | |
std::string data; | |
char buffer[BUFSIZ]; | |
FILE *stream = popen(cmd.c_str(), "r"); | |
while (fgets(buffer, BUFSIZ, stream) != NULL ) | |
data.append(buffer); | |
pclose(stream); | |
return data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment