使用文本文件中的var [英] Using a var from a text file

查看:130
本文介绍了使用文本文件中的var的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,我想使用从carac中收到的关键字从一个文本文件启动的功能,并使用字符串后的carac在这个功能,在其他文件包括,但我不知道如何做它。

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
    }
}


推荐答案

如果我正确理解你需要做的是再次提取:

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();
}

这篇关于使用文本文件中的var的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆