src/linux_parser.cpp
// TODO: Read and return the command associated with a process
// REMOVE: [[maybe_unused]] once you define the function
Read and return the command associated with a process
REMOVE: [[maybe_unused]] once you define the function
Read and return the command associated with a process REMOVE : [[ maybe_unused ]] once you define the function
string LinuxParser::Command(int pid) { 
  string line;
  string command = "NA"; 
  std::ifstream stream(kProcDirectory + std::to_string(pid) + kCmdlineFilename);
  if (stream.is_open()) {
        std::getline(stream, line); 
  		std::istringstream linestream(line);
    	linestream >> command;
    }
  return command;   
}
string LinuxParser :: Command ( int pid ) { string line ; string command = " " ; std :: ifstream stream ( kProcDirectory + std :: to_string ( pid ) + kCmdlineFilename ) ; if ( stream . is_open ( ) ) { std :: getline ( stream , line ) ; std :: istringstream linestream ( line ) ; linestream >> command ; } return command ; }
TODO: Read and return the command associated with a process
REMOVE: [[maybe_unused]] once you define the function
TODO : Read and return the command associated with a process REMOVE : [[ maybe_unused ]] once you define the function
//Read line