提问人:Jabu 提问时间:9/3/2023 更新时间:9/3/2023 访问量:91
如何在 c++/qt 中使用 curl cmd
How to use curl cmd in c++/qt
问:
为什么我通过以下错误返回:output
process
curl: (6) Could not resolve host: application
curl: (3) URL using bad/illegal format or missing URL
当我按下并键入时,相同的代码可以正常工作win+r
cmd.exe /k curl -H "Accept: application/vnd.github.v3.raw" -L "https://api.github.com/repos/jajabu33/test/branches"
QString Debugger::process(const QString& program, const QStringList& arguments)
{
QProcess process;
QByteArray output;
QObject::connect(&process, &QProcess::readyReadStandardOutput, [&]
{
output += process.readAllStandardOutput();
});
process.setProcessChannelMode(QProcess::MergedChannels);
process.start(program, arguments);
QEventLoop eventLoop;
QObject::connect(&process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), &eventLoop, [&] { eventLoop.quit(); });
eventLoop.exec();
return output;
}
QString output = process("cmd.exe", {"/c curl -H \"Accept: application/vnd.github.v3.raw\" -L \"https://github.com/jajabu33/test/branches\""});
答: 暂无答案
下一个:高 DPI 导致像素图缩放错误
评论
QString output = process("cmd.exe", {"/c", "curl", "-H", "Accept: application/vnd.github.v3.raw", "-L", "https://github.com/jajabu33/test/branches"});
cmd
libcurl