首页 > 解决方案 > 如何在 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++ 获取有关主板的信息?

谢谢朋友!

标签: c++motherboard

解决方案


推荐阅读