src/linux_parser.cpp
// TODO: Read and return the total number of processes
Read and return the total number of processes
Read and return the total number of processes
int LinuxParser::TotalProcesses() {
  string key, line, totalPcs;
  int totalProcessCount;
  std::ifstream istream(kProcDirectory + kStatFilename);
  if (istream.is_open()) {
    while (std::getline(istream, line)) {
      std::istringstream istringstream(line);
      istringstream >> key >> totalProcessCount;
      if (key == "processes") return totalProcessCount;
    }
  }
  return 5;
}
int LinuxParser :: TotalProcesses ( ) { string key , line , totalPcs ; int totalProcessCount ; std :: ifstream istream ( kProcDirectory + kStatFilename ) ; if ( istream . is_open ( ) ) { while ( std :: getline ( istream , line ) ) { std :: istringstream istringstream ( line ) ; istringstream >> key >> totalProcessCount ; if ( key == " " ) return totalProcessCount ; } } return 5 ; }
TODO: Read and return the total number of processes
TODO : Read and return the total number of processes