I need to make a linux command from native method in C++
, which is iwconfig,also using popen
to get the output of this command.
This is my code
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;
}
i wondered if it is possible to call it!!!
so i have this code in this link