src/linux_parser.cpp
// 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 key, value, uid, line;
  std::ifstream stream(kProcDirectory + std::to_string(pid) + kStatusFilename);
  if (stream.is_open()) {
    while (std::getline(stream, line)){
  		std::istringstream linestream(line);
    	while (linestream >> key >> value) {
        	if (key == "Uid:") { uid = value;}
        	}
      	}
    }
  return uid;
}
string LinuxParser :: Uid ( int pid ) { string key , value , uid , line ; std :: ifstream stream ( kProcDirectory + std :: to_string ( pid ) + kStatusFilename ) ; if ( stream . is_open ( ) ) { while ( std :: getline ( stream , line ) ) { std :: istringstream linestream ( line ) ; while ( linestream >> key >> value ) { if ( key == " " ) { uid = value ; } } } } return uid ; }
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