c++ _popen读取管道内容(输出内容)例子

FILE * pPipe = _popen(_postExEPath.toStdString().c_str(), "rb");
QString strData;
if (pPipe)

while (!feof(pPipe))
{
std::string tempStr(1024, '');
fgets((char *)tempStr.c_str(), 1024, pPipe);
strData.append(QString::fromLocal8Bit(tempStr.c_str()));
}
fclose(pPipe);
}

原文地址:https://www.cnblogs.com/gx1069/p/6878641.html