ReadTemp.C
00001 #include "ReadTemp.H"
00002
00003 ReadTemp::ReadTemp()
00004 {
00005 itsTempFile = "/proc/acpi/thermal_zone/THRM";
00006 itsTempCol = 2;
00007 }
00008
00009 ReadTemp::~ReadTemp()
00010 {}
00011
00012 const ushort ReadTemp::getTemp() const
00013 {
00014 const char *filename = itsTempFile.c_str();
00015 std::ifstream infile(filename,std::ios::in);
00016 char count = 1;
00017 std::string in;
00018 while(infile >> in)
00019 {
00020 if(count == itsTempCol)
00021 {
00022 break;
00023 }
00024 count++;
00025 }
00026 return static_cast<ushort>(atoi(in.c_str()));
00027 };