src/linux_parser.cpp
string LinuxParser::Uid(int pid) { 
  string name = "Uid";
  string title, value;
  std::ifstream stream(kProcDirectory + to_string(pid) + kStatusFilename);
  string line;
  while (std::getline(stream, line)){
    if(line.compare(0, name.size(), name) == 0){
      std::istringstream linestream(line);
      linestream >> title >> value;
      break;
    }
  }
  return value; 
}
// TODO: Read and return the user ID associated with a process
// REMOVE: [[maybe_unused]] once you define the function
Read and return the user ID associated with a process
REMOVE: [[maybe_unused]] once you define the function
Read and return the user ID associated with a process REMOVE : [[ maybe_unused ]] once you define the function
string LinuxParser::Uid(int pid) { 
  string name = "Uid";
  string title, value;
  std::ifstream stream(kProcDirectory + to_string(pid) + kStatusFilename);
  string line;
  while (std::getline(stream, line)){
    if(line.compare(0, name.size(), name) == 0){
      std::istringstream linestream(line);
      linestream >> title >> value;
      break;
    }
  }
  return value; 
}
string LinuxParser :: Uid ( int pid ) { string name = " " ; string title , value ; std :: ifstream stream ( kProcDirectory + to_string ( pid ) + kStatusFilename ) ; string line ; while ( std :: getline ( stream , line ) ) { if ( line . compare ( 0 , name . size ( ) , name ) == 0 ) { std :: istringstream linestream ( line ) ; linestream >> title >> value ; break ; } } return value ; }
TODO: Read and return the user ID associated with a process
REMOVE: [[maybe_unused]] once you define the function
TODO : Read and return the user ID associated with a process REMOVE : [[ maybe_unused ]] once you define the function