c++ - 如何在 Linux 中使用 C++ 获取有关主板的信息?
问题描述
对于 Linux 中的 CPU:
// ...
string str;
ifstream file("/proc/cpuinfo");
while (file) {
std::getline(file, str);
if (str.find("model name") != std::string::npos) {
// ...
}
else
if (str.find("vendor_id") != std::string::npos) {
// ...
}
// ...
}
您可以获得有关处理器的信息。以及如何在 Linux 中使用 C++ 获取有关主板的信息?
谢谢朋友!
解决方案
推荐阅读
- android - 如何在 AsyncTask 中向 ConstraintLayout 添加新的 ImageView?
- android - getAdapterPosition 已弃用 我应该改用什么?
- html - 元素的行为就像它总是有效的(:valid)
- mysql - 我有数组对象,想验证一些文件,如电子邮件、联系人编号
- ios - 尽管有计划,iOS 目标仍会覆盖 watchOS
- python - 在 django models.py 中使用 if else
- openshift - 创建后是否可以跨集群使用相同的 imagePullSecret?
- ios - 如何在同一 WiFi 网络上扫描 SONOS 扬声器?
- api - 如何从 Pinterest 视频中获取图像缩略图?
- javascript - 如何将 jQuery 代码转换为 JavaScript?