src/linux_parser.cpp
int LinuxParser::TotalProcesses() 
{ 
  std::ifstream filestream(kProcDirectory + kStatFilename);
  string processName,processNumber;
  int processNumberInt;
  string line;
  if (filestream.is_open())
  {
    while (std::getline(filestream, line))
      {
        std::istringstream linestream(line);
        linestream >> processName >> processNumber;
        if(processName == "processes")
        {
          processNumberInt = std::stoi(processNumber);
          break;
        }

      }
  }
  return processNumberInt; 
}
//  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() 
{ 
  std::ifstream filestream(kProcDirectory + kStatFilename);
  string processName,processNumber;
  int processNumberInt;
  string line;
  if (filestream.is_open())
  {
    while (std::getline(filestream, line))
      {
        std::istringstream linestream(line);
        linestream >> processName >> processNumber;
        if(processName == "processes")
        {
          processNumberInt = std::stoi(processNumber);
          break;
        }
      }
  }
  return processNumberInt; 
}
int LinuxParser :: TotalProcesses ( ) { std :: ifstream filestream ( kProcDirectory + kStatFilename ) ; string processName , processNumber ; int processNumberInt ; string line ; if ( filestream . is_open ( ) ) { while ( std :: getline ( filestream , line ) ) { std :: istringstream linestream ( line ) ; linestream >> processName >> processNumber ; if ( processName == " " ) { processNumberInt = std :: stoi ( processNumber ) ; break ; } } } return processNumberInt ; }
Read and return the total number of processes
Read and return the total number of processes