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 value, line, key;
  int totalProcesses = -1;
  std::ifstream stream(kProcDirectory + kStatFilename);
  if (stream.is_open()) {
    while (std::getline(stream, line)){
  		std::istringstream linestream(line);
    	while (linestream >> key >> value) {
          if (key == "processes"){
            totalProcesses = std::stoi(value);
          }
        }
    }
  }
  return totalProcesses;
}
int LinuxParser :: TotalProcesses ( ) { string value , line , key ; int totalProcesses = -1 ; std :: ifstream stream ( kProcDirectory + kStatFilename ) ; if ( stream . is_open ( ) ) { while ( std :: getline ( stream , line ) ) { std :: istringstream linestream ( line ) ; while ( linestream >> key >> value ) { if ( key == " " ) { totalProcesses = std :: stoi ( value ) ; } } } } return totalProcesses ; }
TODO: Read and return the total number of processes
TODO : Read and return the total number of processes