Cod sursa(job #3272071)

Utilizator MihneaStoicaMihnea Teodor Stoica MihneaStoica Data 28 ianuarie 2025 12:09:43
Problema A+B Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.76 kb
#include <bits/stdc++.h>

using namespace std;

string exec(const char* cmd) {
    char buffer[1024];
    string result;
    FILE* pipe = popen(cmd, "r");
    if (!pipe) return "Error";
    while (fgets(buffer, sizeof(buffer), pipe) != nullptr) {
        result += buffer;
    }
    pclose(pipe);
    return result;
}


vector<string> splitString(const string &input) {
    vector<string> words;
    stringstream ss(input);
    string word;
    while (ss >> word) {
        words.push_back(word);
    }
    return words;
}

signed main() {
#ifdef _WIN32
	string s = exec("dir");
	assert(!s.empty());
#else
	string s = exec("ls");
	auto lot = splitString(s);
	
	assert(lot.size() > 0);
#endif
}

/*
/
	unknown/
		?.cpp
		trans.in

*/