Okay here's the issue i want to call the wmic.exe that is found in \windows\system32\wbem execute a command and only read the output from there.
I don't want to use wmi using com as per msdn (http://msdn.microsoft.com/en-us/library/aa390423(v=vs.85).aspx) and i dont want to execute wmic through cmd.
And i can't get a way of making it work.I read this thread too but no one answered non-trivial use of `Console` by `wmic.exe`
I've tried something like this :
FILE* pipe = _popen("wmic.exe cpu get", "r");
if (!pipe)
throw std::exception("error");
char buffer[128];
std::string output;
while(!feof(pipe))
{
if(fgets(buffer, 128, pipe) != NULL) output += buffer;
}
_pclose(pipe);
std::stringstream oss(output);
std::vector<std::string> processor_description;
std::string buffer;
while (std::getline(oss, buffer))
processor_description.push_back(buffer);