src/linux_parser.cpp
int LinuxParser::TotalProcesses() {
  int TotalProcesses;
  string key, value, line;
  std::ifstream filestream(kProcDirectory + kStatFilename);
  if (filestream.is_open()) {
    while (std::getline(filestream, line)) {
      std::istringstream linestream(line);
      linestream >> key >> value;
      if (key == "processes" && value != "") {
        TotalProcesses = stoi(value);
        return TotalProcesses;
      }
    }
  }
  filestream.close();
  return 0;
}
// REVIEW: Read and return the count of all processes in the system
Read and return the count of all processes in the system
Read and return the count of all processes in the system
int LinuxParser::TotalProcesses() {
  int TotalProcesses;
  string key, value, line;
  std::ifstream filestream(kProcDirectory + kStatFilename);
  if (filestream.is_open()) {
    while (std::getline(filestream, line)) {
      std::istringstream linestream(line);
      linestream >> key >> value;
      if (key == "processes" && value != "") {
        TotalProcesses = stoi(value);
        return TotalProcesses;
      }
    }
  }
  filestream.close();
  return 0;
}
int LinuxParser :: TotalProcesses ( ) { int TotalProcesses ; string key , value , line ; std :: ifstream filestream ( kProcDirectory + kStatFilename ) ; if ( filestream . is_open ( ) ) { while ( std :: getline ( filestream , line ) ) { std :: istringstream linestream ( line ) ; linestream >> key >> value ; if ( key == " " && value != " " ) { TotalProcesses = stoi ( value ) ; return TotalProcesses ; } } } filestream . close ( ) ; return 0 ; }
REVIEW: Read and return the count of all processes in the system
REVIEW : Read and return the count of all processes in the system