src/linux_parser.cpp
string LinuxParser::Uid(int pid) {
  string line, key, value;
  string Uid;
  std::ifstream filestream(kProcDirectory + to_string(pid) + kStatusFilename);
  if (filestream.is_open()) {
    while (std::getline(filestream, line)) {
      std::istringstream linestream(line);
      linestream >> key >> value;
      if (key == "Uid:") {
        Uid = value;
        return Uid;
      }
    }
  }
  filestream.close();
  return "no Uid";
}
// REVIEW: Read and return the user ID associated with a process
Read and return the user ID associated with a process
Read and return the user ID associated with a process
string LinuxParser::Uid(int pid) {
  string line, key, value;
  string Uid;
  std::ifstream filestream(kProcDirectory + to_string(pid) + kStatusFilename);
  if (filestream.is_open()) {
    while (std::getline(filestream, line)) {
      std::istringstream linestream(line);
      linestream >> key >> value;
      if (key == "Uid:") {
        Uid = value;
        return Uid;
      }
    }
  }
  filestream.close();
  return "no Uid";
}
string LinuxParser :: Uid ( int pid ) { string line , key , value ; string Uid ; std :: ifstream filestream ( kProcDirectory + to_string ( pid ) + kStatusFilename ) ; if ( filestream . is_open ( ) ) { while ( std :: getline ( filestream , line ) ) { std :: istringstream linestream ( line ) ; linestream >> key >> value ; if ( key == " " ) { Uid = value ; return Uid ; } } } filestream . close ( ) ; return " " ; }
REVIEW: Read and return the user ID associated with a process
REVIEW : Read and return the user ID associated with a process