Cod sursa(job #3272068)
Utilizator | Data | 28 ianuarie 2025 12:06:54 | |
---|---|---|---|
Problema | A+B | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.49 kb |
#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
*/