Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "utility.h"
- Utility::Utility()
- {
- }
- QString Utility::statusBatteryLaptop()
- {
- std::ifstream myFile("/sys/class/power_supply/BAT0/capacity");
- QString line ;
- if(myFile.is_open())
- {
- std::string str;
- while (getline(myFile,str) )
- {
- line = QString::fromLocal8Bit(str.c_str());
- }
- myFile.close();
- }
- else
- {
- qDebug() << "Unable to open file";
- }
- return line;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement