Using a var from a text file

依然范特西╮ 提交于 2019-12-20 07:52:37

问题


My problem is that I would like to use the function launched by the keyword received in carac from a text file, and use the string right after carac in this function that is in an other file included but I have no idea how to do it.

for(std::string carac; fichier>>carac;)
{
    auto found = _map.find(carac);
    if(found != _map.end()
    {
        found->second();
        pile_double.afficher(); // Pile is the french word for a LIFO Queue, afficher is the one for display
    }
}

回答1:


If I'm understanding correctly all you need to do is extract again:

if (found != _map.end())
{
    std::string name;
    fichier >> name; // this is the second word

    found->second();
    pile_double.afficher();
}


来源:https://stackoverflow.com/questions/24071793/using-a-var-from-a-text-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!