void QuantitationInfo::initialise ()
{
	GenIFStream fromFile ( MsparamsDir::instance ().getParamPath ( "quan.txt" ) );
	string line;
	while ( getline ( fromFile, line ) ) {
		if ( line.length () != 0 && line [0] != '#' ) {
			name.push_back ( line );
			string n = name.back ();
			StringVector sv;
			for ( ; ; ) {
				string modificationName;
				getline ( fromFile, modificationName );
				if ( modificationName [0] == '>' ) {
					if ( sv.empty () && n != "Label:15N" ) {
						ErrorHandler::genError ()->error ( "No quantitation modifications specified for quantitation type " + n + " in file quan.txt.\n" );
					}
					break;
				}
				else
					sv.push_back ( modificationName );
			}
			singQuanInfo [n] = sv;
		}
	}
}
Пример #2
0
void AddRecipe(map<string, vector<string> >& recipes)
{
	string name, ingredient, garbage;

	//Clear cin.
	//Fixes a bug where getline was assiging empty strings with no user input
	//to name & ingredient.
	getline(cin, garbage, '\n'); 

	cout << "\n----------\n"
		 << "ADD RECIPE\n"
		 << "----------\n\n"
		 << "Enter the name for the recipe: ";
	getline(cin, name, '\n');
	cout << endl;

	do
	{
		cout << "Enter ingredient and amount, E.G. \"1 cup flour\"\n"
			 << "or type \"done\" when done.\n";
		getline(cin, ingredient, '\n');
		if (ingredient != "done")
		{
			//Add to the map.
			recipes[name].push_back(ingredient);
			cout << "\nAdded \"" << ingredient << "\".\n\n";
		}
	} while (ingredient != "done");

	cout << endl;
}
Пример #3
0
void read_spec(vector<Event*>& events) {
  ifstream es("EVENT.SPEC");

  if (!es) {
    cerr << "Cannot open EVENT.SPEC file" << endl;
    exit(1);
  }

  string line, section, name;
  int nfields;

  while ( getline(es, line) ) {
    if ( line[0] == '@' ) {
      // -- new section
      section = line.substr(2);
    } else if ( line[0] != '#' && line[0] != '\0' ) {
      // -- new event
      name = line;
      es >> nfields;
      skip_line(es);
      Event* event = new Event(name, nfields, section);
      for (int i=0; i<nfields; ++i) {
        Field field;
        getline(es, event->fields[i].type);
        getline(es, event->fields[i].fname);
        getline(es, event->fields[i].descr);
      }
      events.push_back(event);
      section = "";
    }
  }
int main()
{
  const size_t count = 100;
  string names[count];
  string ages[count];
  string firstname;
  string secondname;

  for(size_t i = 0 ; i<count ; i++)
  {
    cout << endl << "Enter a first name or press Enter to end: ";
    getline(cin, firstname, '\n');
    if(firstname.empty())
    {
      listnames(names, ages, i);
      cout << "Done!!" << endl;
      return 0;
    }

    cout << "Enter a second name: ";
    getline(cin, secondname, '\n');

    names[i] = firstname + ' ' + secondname;
    cout << "Enter " + firstname + "'s age: ";
    getline(cin, ages[i], '\n');
  }
  cout << "No space for more names." << endl;
  listnames(names, ages, count);
  return 0;
}
Пример #5
0
 void repl(shared_ptr< environment > env_p)
 {
   cout << prompt;
   string line;
   while (getline(cin, line)) {
     string code = line;
     stack< int > open_parens;
     while (!paren_match(code) || !quot_match(code)) {
       int ind = indent(line, open_parens);
       cout << string(ind + prompt.length(), ' ');
       if (!getline(cin, line)) {
         cout << bye;
         return;
       }
       if (quot_match(code))
         code.push_back(' ');
       code += line;
     }
     vector< string > parts = split(code);
     for (auto it = begin(parts); it + 1 < end(parts); ++it)
       eval(parse(*it), env_p);
     if (!parts.empty()) {
       value retval = eval(parse(parts.back()), env_p);
       apply_visitor(return_value_visitor(), retval);
     }
     cout << prompt;
   }
   cout << bye;
 }
Пример #6
0
int main(void) {
  int num_cases;
  cin >> num_cases >> ws;

  string line;

  while (num_cases--) {
    int num_computers;
    cin >> num_computers >> ws;
    union_find uf(num_computers);
    getline(cin, line);
    int good = 0, bad = 0;
    while (!line.empty()) {
      stringstream ss(line);
      char c;
      int first; 
      int second;
      ss >> c >> first >> second;
      if (c == 'c')
	uf.union_set(first-1, second-1);
      if (c == 'q')
	if (uf.find_set(first-1) == uf.find_set(second-1))
	  good ++;
	else
	  bad++;
      getline(cin, line);
    }
    cout << good << "," << bad << endl;
    if (num_cases)
      cout << endl;
  }
}
Пример #7
0
//---------------------------------------------------------------------------
void __fastcall TMainForm::LoadFromFile(const AnsiString FileName)
{
  std::ifstream in_file(FileName.c_str());
  if (!in_file)
  {
    ShowError("File cannot be opened!");
    return;
  }
  switch (FileName[FileName.Length()])
  {
    case 'm':
    case 'M':
    in_file >> rows >> cols >> lyrs;
    if (rows > MAX_DIM || cols > MAX_DIM || lyrs > MAX_DIM)
    {
      ShowError(("An array dimension cannot be more than " +
        IntToStr(MAX_DIM)).c_str());
      return;
    }
    pgcProblems->ActivePage = tbsMatrix;
    udwRows->Position = rows;
    udwColumns->Position = cols;
    udwLayers->Position = lyrs;
    udwLayer->Position = 1;
    for (int k = 0; k < lyrs; k++)
      for (int i = 0; i < rows; i++)
        for (int j = 0; j < cols; j++)
          in_file >> a[i][j][k];
    ShowMatrix();
    break;
    case 'l':
    case 'L':
    pgcProblems->ActivePage = tbsStudents;
    std::string tmps;
    StudList->Items->BeginUpdate();
    StudList->Clear();
    for (;;)
    {
      using std::getline;
      getline(in_file, tmps);
      if (!(tmps.length() && in_file)) goto ready;
      TListItem *Item = StudList->Items->Add();
      Item->Caption = tmps.c_str();
      for (int i = 0; i < 8; i++)
      {
        getline(in_file, tmps);
        Item->SubItems->Add(tmps.c_str());
      }
      while (in_file.get() != '\n')
        if (!in_file) goto ready;
    }
    ready:
    StudList->Items->EndUpdate();
    break;
  }
}
Пример #8
0
void name()
{
    string name1, name2;
    cout << "Enter your first name: ";
    getline(cin,name1);
    cout << "Enter your last name: ";
    getline(cin,name2);
    name1 = name2 + ", " + name1;
    cout << "Here's the information in a single string " << name1 << endl;
}
Пример #9
0
void readImageData( istream& is, cv::Mat_<cv::Vec3b>& cimg, cv::Mat_<cv::Vec3f>& points, cv::Mat_<float>& dimg)
{
    string ln;
    getline( is, ln);
    istringstream iss(ln);

    cv::Size imgSz;
    iss >> imgSz.height >> imgSz.width;
    cimg = cv::Mat_<cv::Vec3b>( imgSz);
    points = cv::Mat_<cv::Vec3f>( imgSz);
    dimg = cv::Mat_<float>( imgSz);

    const int sz = imgSz.width * imgSz.height;
    const int pxlChunk = 3*sizeof(float) + 3*sizeof(byte);
    const int totalBytes = sz * pxlChunk;
    char* buff = (char*)malloc( totalBytes);

    int readBytes = 0;
    while ( readBytes < totalBytes)
    {
        is.read( &buff[readBytes], totalBytes-readBytes);
        const int numBytesRead = is.gcount();
        if ( numBytesRead <= 0)
            break;
        readBytes += numBytesRead;
    }   // end while

    assert( readBytes == totalBytes);

    for ( int i = 0; i < sz; ++i)
    {
        int j = i * pxlChunk;   // Offset into read in buffer

        // Read in points (with respect to origin)
        cv::Vec3f p( *(float*)&buff[j], // X
                     *(float*)&buff[j+sizeof(float)], // Y
                     *(float*)&buff[j+2*sizeof(float)]);    // Z (depth)

        j += 3*sizeof(float);   // Skip to colour bytes
        cv::Vec3b c( (byte)buff[j], (byte)buff[j+1], (byte)buff[j+2]);

        const int row = i / imgSz.width;  // Integer division
        const int col = i % imgSz.width;

        cimg.at<cv::Vec3b>(row,col) = c;
        points.at<cv::Vec3f>(row,col) = p;
        dimg.at<float>(row,col) = p[2]; // Depth is just the Z value
    }   // end for

    free(buff);

    getline( is, ln);  // Read end of line
}   // end readImageData
Пример #10
0
bool XMLIStreamList::getNext ( string& s )
{
	bool flag = false;
	string line;
	while ( getline ( ist, line ) ) {
		if ( line.find ( nameStart ) != string::npos ) {	// start tag found
			while ( getline ( ist, line ) ) {
				if ( line.find ( nameEnd ) != string::npos ) return true;	// end tag found
				s += line;
			}
		}
	}
	return false;
}
Пример #11
0
  void scn::ReadUNetworkFromNetFile(UNetwork<>::pNetwork &network,char * path)
   {
      using std::getline;
      using std::string;
      using std::cout;
      using std::endl;
      std::ifstream infile(path);
      UGraph::pGraph graph(new UGraph());
      network.reset(new UNetwork<>(graph));
	  
      string line;
      string temp;
      std::stringstream ss;
      //read header
      while(getline(infile, line))
      {
	 ss.str(line);
	 if(ss>>temp && temp == "*Vertices")
	 {//read nodes
	    size_t numberOfNodes;
	    ss>>numberOfNodes;
	    size_t index;
	    string flag;
	    double x,y,z;
	    for(size_t i = 0; i < numberOfNodes; i++)
	    {
	       getline(infile, line);
	       ss.clear();
	       ss.str(line);
	       if(ss>>index>>flag>>x>>y>>z)//read content
	       {
		  graph->AddNode(index - 1);
		  network->SetNodePosition(index - 1, x, y, z);
	       }
	    }
	    assert(numberOfNodes == graph->GetNumberOfNodes());
	 }
	 else if(line == "*Edges")
	 {//read edge
	    size_t indexOfNode1, indexOfNode2;
	    double weight;
	    while(getline(infile, line))
	    {
	       ss.clear();
	       ss.str(line);
	       if(ss>>indexOfNode1>>indexOfNode2>>weight)
		  graph->AddEdge(indexOfNode1 - 1, indexOfNode2 -1);
	    }
	 }
Пример #12
0
string getVersionFromPPXMLFile ( const string& filename )
{
	GenIFStream ist ( filename );
	string line;
	getline ( ist, line );
	getline ( ist, line );	// Version is stored on the second line
	int start = line.find ( "Version" ) + 8;
	if ( start != string::npos ) {
		int end = line.find ( "?", start );
		if ( end != string::npos ) {
			return line.substr ( start, end - start );
		}
	}
	return "";
}
Пример #13
0
		FileStopper(const string &languageCode) :
			Xapian::SimpleStopper(),
			m_languageCode(languageCode),
			m_stopwordsCount(0)
		{
			if (languageCode.empty() == false)
			{
				ifstream inputFile;
				string fileName(PREFIX);

				fileName += "/share/pinot/stopwords/stopwords.";
				fileName += languageCode;
				inputFile.open(fileName.c_str());
				if (inputFile.good() == true)
				{
					string line;

					// Each line is a stopword
					while (getline(inputFile, line).eof() == false)
					{
						add(line);
						++m_stopwordsCount;
					}
				}
				inputFile.close();

#ifdef DEBUG
				cout << "FileStopper: " << m_stopwordsCount << " stopwords for language code " << languageCode << endl;
#endif
			}
		}
Пример #14
0
int main()
{
	bool repeat = 1;
	while (repeat == 1)
	{

		//main variables
		int whichOne;
		string inStr = "";

		cout << "   Checking for PALINDROME or REVERSING" << endl;
		cout << "1- Iterative word or phrase REVERSE for just $1" << endl;
		cout << "2- Recursive word or phrase REVERSE for only $2" << endl;
		cout << "3- Iterative PALINDROME check, and word or phrase REVERSE a mere $5" << endl;
		cout << "4- Grand slam: Recursive PALINDROME check, and word or phrase REVERSE $40" << endl;

		cout << "Please enter a word or phrase (alphanumeric only, no punctuation): " << endl;
		getline(cin, inStr);
		
		//function sanitizes numeric input
		whichOne = getInt();

		//main switch statement
		picker(whichOne, inStr);

		//check for repeat
		cout << "Would you like another one?" << endl;
		cout << "0- no / 1- yes" << endl;
		cin >> repeat;
	}
	return 0;
}
Пример #15
0
int main(void) {
  std::ios_base::sync_with_stdio (false);
  size_t n;
  cin >> n >> ws;
  vvs graph(n, vs());

  dfs_num.resize(n, 0);
  parent.resize(n, -1);
  finished = false;
  a = b = c = -1;

  string line;
  for (size_t line_cnt = 0; line_cnt < n; line_cnt++) {
    getline(cin, line);
    for (size_t char_cnt = 0; char_cnt < n; char_cnt++) {
      if (line.at(char_cnt) == '1')
	graph[line_cnt].push_back(char_cnt);
    }
  }
  for (size_t counter = 0; counter < n; counter++)
    if (!dfs_num[counter])
      dfs(graph, counter);
  if (a >= 0)
    cout << a+1 << " " << b+1 << " " << c+1 << endl;
  else
    cout << -1 << endl;

  return 0;
}
Пример #16
0
// returns pointer to shape object instantiated in heap
Shape* getShape() {
	Shape* pShape = 0; // initializes pointer to null by default
	string tempColor, tempShape; // instantiates string objects for storing user inputs

	// prompts user for input and passes user input to string object
	cout << "\nEnter the shape's color (or 'done')..." << endl;
	getline( cin, tempColor );
	// checks if user wants to stop getting shapes
	if ( strtoupper( tempColor ) == "DONE" ) {
		return pShape; // returns null pointer to end array of pointers to shape objects
	}
    // iterates until an object is returned
    while ( 1 ) {
        // prompts user for input and passes user input to string object
        cout << "Enter shape type..." << endl;
        cin >> tempShape;
        cin.ignore( numeric_limits< streamsize >::max(), '\n' ); // discards space and subsequent inputs
        // checks if user entered valid shape, instantiates a new object and returns pointer to object
        if ( strtoupper( tempShape ) == "CIRCLE" ) {
            double tempRadius; // declares double variable for storing size of shape
            // validates, or otherwise, rejects and repeats, input
            while ( ( cout << "Enter the radius..." << endl ) && !( cin >> tempRadius ) ) {
                cin.clear(); // clears bad input flag
                cin.ignore( numeric_limits< streamsize >::max(), '\n' ); // discards input
                cout << "You did not enter a valid shape size.  Try again.\n";
            }
            cin.ignore( numeric_limits< streamsize >::max(), '\n' ); // discards space and subsequent inputs
            pShape = new Circle( tempColor, tempRadius ); // instantiates new shape object in heap
            return pShape; // returns pointer to shape object
        }
        // checks if user entered valid shape, instantiates a new object and returns pointer to object
        else if ( strtoupper( tempShape ) == "SQUARE" ) {
Пример #17
0
void trait::add_traits() {
	ifstream file("trait.csv");
	if (!file.is_open())
		throw exception("File \"traits.csv\" is not found.");

	int current_index = 0, test_index;

	string buffer;
	while (!file.eof()) {
		getline(file, buffer);

		vector<string> values = parse_csv_line(buffer);
		auto it = values.begin();

		stringstream ss(*it);
		ss >> test_index;
		if (current_index != test_index) {
			file.close();
			throw exception("There's a mistake in \"traits.csv\".");
		}

		traits.push_back(trait(*(++it)));
		++current_index;
	}

	file.close();
}
Пример #18
0
static bool read_labels(const string& path,
    vector<string>& filenames, vector< vector<Rect> >& labels)
{
    string labels_path = path + "/gt.txt";
    string filename, line;
    int x1, y1, x2, y2;
    char delim;
    ifstream ifs(labels_path.c_str());
    if( !ifs.good() )
        return false;

    while( getline(ifs, line) )
    {
        stringstream stream(line);
        stream >> filename;
        filenames.push_back(path + "/" + filename);
        vector<Rect> filename_labels;
        while( stream >> x1 >> y1 >> x2 >> y2 >> delim )
        {
            filename_labels.push_back(Rect(x1, y1, x2, y2));
        }
        labels.push_back(filename_labels);
        filename_labels.clear();
    }
    return true;
}
int getMovieMap(const char* filename, std::map<long, Movie>& movieMap)
{
	string currentLine;						 // To hold the entire currentline
	vector<string> splitData;				 // To hold the double values from the currentline
	long movieId = 0;
	
	// Build a map from movie_ids to their titles
	ifstream infile(filename);						 // Open the file for getting the input

	//Always test the file open.
	if(!infile) 
	{
	  cout<<"Error opening output file"<<endl;
	  return -1;
	}
	
	// keep on reading till we get to the end of the file
	while(getline(infile, currentLine))
	{
		// Get the movie id and the name as strings
		splitData = getMovieIdName(currentLine);

		// Extract the movie id
		movieId = (long)atof(splitData[0].c_str());

		// Add the movie to the movieMap
		movieMap[movieId] = Movie(movieId, splitData[1]);
	}
	
	cout<<"Total Number of Movies: "<<movieMap.size()<<endl;
	
	infile.close();

	return 0;
}
Пример #20
0
void add_answers() {
	ifstream file("answers.csv");
	if (!file.is_open())
		throw exception("File \"answers.csv\" is not found.");

	string buffer, answer_text;
	size_t question_index;
	trait_num tr_num;
	int tr_sc;

	while (!file.eof()) {
		getline(file, buffer);

		vector<string> values = parse_csv_line(buffer);

		auto it = values.begin();
		stringstream ss(*(it++));
		ss >> question_index;
		answer_text = *(it++);

		vector<answer::point> points;
		while (it != values.end()) {
			stringstream trait_number(*(it++)), trait_score(*(it++));
			trait_number >> tr_num;
			trait_score >> tr_sc;
			points.push_back(answer::point(tr_num, tr_sc));
		}
		test::questions[question_index].push(answer(answer_text, points));
	}

	file.close();
}
Пример #21
0
void CmdLineOptions::process_config_file() {
    string file_name = get_stropt_value(m_config_file_option);
    ifstream infile(file_name.c_str());

    if ( !infile ) {
        throw ConfigFileOpenFailed(file_name);
    }

    string line;
    while ( getline(infile, line) ) {
        pg_string::trim(line);
        size_t len = line.length();
        if ( !(len == 0 || line[0] == '#') ) {
            pair<string, string> kvpair = pg_string::get_key_value(line);
            if ( kvpair.second == "" ) {
                m_flags[kvpair.first] = true;
            } else {
                try {
                    int value = pg_string::stdstring_to_int(kvpair.second);
                    m_intopts[kvpair.first] = value;
                }
                catch(pg_string::BadValue) {
                    m_stropts[kvpair.first] = kvpair.second;
                }
            }
        }
    }
}
Пример #22
0
int main() {
	vector<string> n_list;
	map<string, int> count;
	string input;
	int n_of_i;
	cin >> n_of_i;
	cin.ignore();
	for (int i = 0; i < n_of_i; ++i) {
		getline(cin, input);
		string n;
		for (char c : input) {
			if (c == ' ')
				break;
			else
				n += c;
		}
		if (std::find(n_list.begin(), n_list.end(), n) == n_list.end()) {
			n_list.push_back(n);
		}
		if (count.count(n) > 0)
			++count[n];
		else
			count[n] = 1;
	}
	int size = n_list.size();
	std::sort(n_list.begin(), n_list.end());
	for (const string& n : n_list) {
		std::cout << n << " " << count[n] << std::endl;
	}
	return 0;
}
Пример #23
0
/**
    Load a dictionary, allowing for subsequent calls to FindWords
    path should lead to a text file with one word per line
    Call FreeDictionary() when finished to free allocated space

    Populates dictionary and alphabet_iter
*/
void LoadDictionary(const char* path)
{
    if (dictionary_loaded)
    {
        cout << "Overwriting existing dictionary" << endl;
        FreeDictionary();
    }

    // Open the file specified by path
    ifstream dict_file(path);
    if (!dict_file.is_open())
    {
        cout << "Failed to access dictionary at path: " << path << endl;
        return;
    }

    // Add all words to our dictionary and sort 
    string temp;
    while (getline(dict_file, temp))
    {
        transform(temp.begin(), temp.end(), temp.begin(), tolower);
        dictionary.push_back(temp);
    }
    sort(dictionary.begin(), dictionary.end());

    // Store iterator for each character for faster searching
    for (char cur_index_char = 'a'; cur_index_char <= 'z' + 1; cur_index_char++)
    {
        temp = cur_index_char;
        alphabet_iter[cur_index_char - 'a'] = lower_bound(dictionary.begin(), dictionary.end(), temp);
    }

    dictionary_loaded = true;
    dict_file.close();
}
Пример #24
0
string Human::getTakeChoice(Market & market)
{
    bool buggedcase = true;
    bool invalidchoice = true;
    do {
        bool invalidchar;
        do {
            cout<<endl << "Please select the cards that you would like to take:"<< endl;
            market.printCards();

            if (buggedcase)
                cin.ignore();
            getline(cin, choice);
            cout << "\033[2J\033[1;1H" << endl;
            choice.erase(std::remove(choice.begin(), choice.end(), ' '), choice.end());
            cout << "Your choice was: " << choice << endl;

            invalidchar = isInvalidChar(choice);
            if (invalidchar)
            {
                buggedcase = false;
                cout << "You entered an invalid character. Please try again." << endl;;
            }//end if
        } while (invalidchar);

        invalidchoice = isInvalidChoice(choice, market.getSize());

        if (invalidchoice)
        {
            buggedcase = false;
            cout << "You entered an invalid choice. Please try again." << endl;
        }//end if
    } while(invalidchoice);
    return choice;
}
Пример #25
0
void ScriptManager::RunScript(string file)
{
    ifstream ifile(file.c_str());

    vector<string> lines;
    string line;

    // Extract the lines into a vector
    while (getline(ifile, line))
    {
        lines.push_back(line);
    }

    // Add the lines to the FRONT of the execution buffer
    // IN REVERSE ORDER to assure they occur sequentially
    for (auto it = lines.rbegin(); it != lines.rend(); ++it)
    {
        // Ignore empty lines and comment lines
        if (it->size() == 0) continue;
        if (it->at(0) == COMMENT_CHAR) continue;

        // Store all other lines in the buffer
        this->commands.push_front(*it);
    }

    ifile.close();
}
Пример #26
0
int main()
{
	string s;
	while (getline(cin, s))
		split(s, ostream_iterator<string>(cout, "\n"));
	return 0;
}
Пример #27
0
// inserts cards from a file into the card table
void Tools::create_cards_file(string file_str)
{
	string line;
	ifstream file(file_str);

	if (file.is_open())
	{
		string line;

		while (getline(file, line))
		{
			vector<string> attr = split(line, ';');

			Card g(attr[1], attr[2], (Card::Rarity)atoi(attr[3].c_str()), (Card::Series)atoi(attr[4].c_str()), (Card::Type)atoi(attr[5].c_str()), atoi(attr[6].c_str()), (Card::Color)atoi(attr[7].c_str()), (Card::Meta_Type)atoi(attr[0].c_str()));

			if (Server::add_card_db(g))
			{
				std::cout << "Added " + g.name + " to the DB" << std::endl;
			}
			else
			{
				std::cout << "Error adding " + g.name + " to the DB" << std::endl;
			}
		}
	}
	else 
	{
		cerr << "Error opening card file.";
	}
}
Пример #28
0
void insert_stat_values(string table[], string pid) {
    string stat_path = get_stat_path(pid);
    ifstream stat_file(stat_path);
    for (int i = 0; i < STAT_VALUES_COUNT; i++)
        getline(stat_file, table[i], ' ');
    stat_file.close();
}
int main()
{
    string word;
    char temp;
    int len, start, end;

    getline(cin, word);
    len = word.length();

    // length is 1-based indexed
    for (start = 0, end = len - 1; start < end; start++, end--) {

        if (word[start] == ' ')
            start++;

        if (word[end] == ' ')
            end--; 

        // check that our initial condition still holds
        if (start < end) {
            temp = word[start];
            word[start] = word[end];
            word[end] = temp;
        }

    }

    cout << word << endl;

    return 0;
}
Пример #30
0
Process get_filled_process_object(string stat_values[], string uid_line) {
    Process process;

    // save pid, ppid, sid, tty
    process.pid = stat_values[0];
    process.ppid = stat_values[3];
    process.sid = stat_values[5];
    process.tty = stat_values[6];

    // save proc_time
    int utime, stime;
    utime = std::stoi(stat_values[13]);
    stime = std::stoi(stat_values[14]);
    process.proc_time = std::to_string(utime + stime);
    
    // save name
    string name = stat_values[1];
    // delete parenthesis
    process.name = name.substr(1, name.size() - 2); 

    // uid_line has following structure:
    // Uid: (real uid) (effective uid) (saved set uid) (filesystem uid)
    // let's use effective uid
    std::stringstream ss(uid_line);
    int const WORD_NUMBER = 3;
    for (int i = 0; i < WORD_NUMBER; i++) {
        getline(ss, process.uid, '\t');
    }

    return process;
}