src/linux_parser.cpp
int LinuxParser::RunningProcesses() {
  int RunningProcesses;
  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 == "procs_running" && value != "") {
        RunningProcesses = stoi(value);
        return RunningProcesses;
      }
    }
  }
  filestream.close();
  return 0;
}
// REVIEW: Read and return the count of running processes in the system
Read and return the count of running processes in the system
Read and return the count of running processes in the system
int LinuxParser::RunningProcesses() {
  int RunningProcesses;
  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 == "procs_running" && value != "") {
        RunningProcesses = stoi(value);
        return RunningProcesses;
      }
    }
  }
  filestream.close();
  return 0;
}
int LinuxParser :: RunningProcesses ( ) { int RunningProcesses ; 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 != " " ) { RunningProcesses = stoi ( value ) ; return RunningProcesses ; } } } filestream . close ( ) ; return 0 ; }
REVIEW: Read and return the count of running processes in the system
REVIEW : Read and return the count of running processes in the system