src/linux_parser.cpp
string LinuxParser::User(int pid) { 
  string name = "x:" + Uid(pid);
  string title, value;
  std::ifstream stream(kPasswordPath);
  string line;
  while (std::getline(stream, line)){
    if(line.find(name) != std::string::npos){
      value = line.substr(0, line.find(":"));
    }
  }
  return value; 
}
// TODO: Read and return the user associated with a process
// REMOVE: [[maybe_unused]] once you define the function
Read and return the user associated with a process
REMOVE: [[maybe_unused]] once you define the function
Read and return the user associated with a process REMOVE : [[ maybe_unused ]] once you define the function
string LinuxParser::User(int pid) { 
  string name = "x:" + Uid(pid);
  string title, value;
  std::ifstream stream(kPasswordPath);
  string line;
  while (std::getline(stream, line)){
    if(line.find(name) != std::string::npos){
      value = line.substr(0, line.find(":"));
    }
  }
  return value; 
}
string LinuxParser :: User ( int pid ) { string name = " " + Uid ( pid ) ; string title , value ; std :: ifstream stream ( kPasswordPath ) ; string line ; while ( std :: getline ( stream , line ) ) { if ( line . find ( name ) != std :: string :: npos ) { value = line . substr ( 0 , line . find ( " " ) ) ; } } return value ; }
TODO: Read and return the user associated with a process
REMOVE: [[maybe_unused]] once you define the function
TODO : Read and return the user associated with a process REMOVE : [[ maybe_unused ]] once you define the function