How do I read system information in C++?

后端 未结 4 1323
谎友^
谎友^ 2021-02-04 16:29

I\'m trying to get information like OS version, hard disk space, disk space available, and installed RAM on a Linux system in C++. I know I can use system() to run

4条回答
  •  醉话见心
    2021-02-04 17:12

    System information is by definition not portable, so there is no standard solution. Your best bet is using a library that does most of the work for you. One such cross platform library (unlike hal, which is currently Linux specific) is SIGAR API, which is open source BTW. I've used it in a C++ project without much trouble (the installation is a bit non-standard but can be figured out easily)

提交回复
热议问题