You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
348 B
21 lines
348 B
#include "Telegram/exec.h" |
|
|
|
#include <iostream> |
|
#include <stdio.h> |
|
|
|
std::string exec(const char* cmd) { |
|
|
|
FILE* pipe = popen(cmd, "r"); |
|
if (!pipe) |
|
return "ERROR"; |
|
|
|
char buffer[128]; |
|
std::string result = ""; |
|
while (!feof(pipe)) { |
|
if (fgets(buffer, 128, pipe) != NULL) |
|
result += buffer; |
|
} |
|
pclose(pipe); |
|
|
|
return result; |
|
}
|
|
|