用文本 C++ 复制数字

问题描述

所以我在 txt 文件中有数据,然后打开 txt 文件,然后查看我提供的关键字 在该关键字之后,它包含诸如 9203 之类的数字,这些数字不断变化。 所以我想知道如果这有意义的话,我如何能够在不知道它们究竟是什么的情况下复制这些数字。

std::fstream iData;
std::string collect;
std::string Value = "Value=";

outfile.open("retrieveData.txt",std::ios::in);
if (outfile.is_open())
{
    unsigned int found = 0;
    while (getline(outfile,collect))
    {
        if (collect.find(Value) != std::string::npos)
            ++found;
    }
    std::cout << "the word was found\n";
    std::cout << "attempting to copy to new txt file\n";
    iData.open("itemValue.txt",std::ios::out);
    iData << Value;
    iData.close();
    std::cout << "Success\n";
}

所以在 Value= string theirs numbers 之后,我也希望能够复制这些数字,因为数字每天都在变化,我无法输入特定数字

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)