Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
41 lines (36 loc) · 1.06 KB

File metadata and controls

41 lines (36 loc) · 1.06 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "ControlPanel.h"
#include <QtWidgets/QApplication>
#include <regex>
#include <string>
using namespace std;
int execmd(char* cmd, char* result) {
char buffer[128]; //定义缓冲区
FILE* pipe = _popen(cmd, "r"); //打开管道,并执行命令
if (!pipe)
return 0; //返回0表示运行失败
while (!feof(pipe)) {
if (fgets(buffer, 128, pipe)) { //将管道输出到result中
strcat(result, buffer);
}
}
_pclose(pipe); //关闭管道
return 1; //返回1表示运行成功
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
char buffer[128];
execmd("VER", buffer);
string tempStr = string(buffer);
smatch subFormulaMatch;
regex pattern(R"(\d+\.\d+\.(\d+))");
regex_search(tempStr, subFormulaMatch, pattern);
if (subFormulaMatch.size()==2&&stoi(subFormulaMatch[1].str()) > 7601)
{
QMessageBox::critical(nullptr, "严重错误", "不支持的系统版本");
return 0;
}
ControlPanel w;
w.show();
return a.exec();
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.