Last active
August 29, 2015 14:14
-
-
Save rajabishek/313a5e949f98ef76bf97 to your computer and use it in GitHub Desktop.
CPU & Memory information - Linux mint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <string> | |
using namespace std; | |
class FileHandling{ | |
public: | |
void read(string name){ | |
string line; | |
ifstream myfile(name.c_str()); | |
if(myfile.is_open()){ | |
while(getline(myfile,line)) | |
cout << line << '\n'; | |
myfile.close(); | |
} | |
else | |
cout << "Unable to open file"<<endl; | |
} | |
}; | |
int main () { | |
FileHandling* file = new FileHandling(); | |
cout<<"------------------ CPU INFO ------------------------"<<endl<<endl; | |
file->read("/proc/cpuinfo"); | |
cout<<"------------------------------------------------------"<<endl<<endl; | |
cout<<"------------------ MEMORY INFO ----------------------"<<endl<<endl; | |
file->read("/proc/meminfo"); | |
cout<<"-----------------------------------------------------"<<endl<<endl; | |
delete file; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment