在24小时C+&#x2B中24小时后解析自动文件.txt。
我有一个项目,我是C ++的新手 好吧,我必须解析一个file.txt,其中包含ATM中的交易信息。并且有名为交易日期的文件。 例如,文件(20211102.TXT)是一个文件,它具有在02/11/2021中创建的所有信息。 因此,午夜后创建另一个文件。 !!我的对象是:每天我都必须从前一天解析文件。 我尝试了一个生成昨天日期的函数。 我必须使用它,但我不知道 - 在
中解析文件的功能
void parse()
{
ifstream file1("20211120.jrn");
string str;
if(file1.is_open())
{
while (getline(file1, str))
{
cout << str << "\n";
}
file1.close();
cout << "PARSING FIRST JOURNAL" << endl;
}
else
cout <<"File not found " << endl;
file1.close();
}
我希望清楚的文件 。 先感谢您。
I have a project and I'm new to C++
Well I have to parse a file.txt that contains transaction informations in an ATM. And there is files named as the date of the transactions.
For example the file (20211102.txt) is a file that has all the informations, created in 02/11/2021.
So after midnight another file is being created .
!! My Objectif is : Every day I have to parse the file from the day before.
I have tried a function that generate the date of yesterday.
I have to use it But I don"t know how
-Here is the function of parsing the file
void parse()
{
ifstream file1("20211120.jrn");
string str;
if(file1.is_open())
{
while (getline(file1, str))
{
cout << str << "\n";
}
file1.close();
cout << "PARSING FIRST JOURNAL" << endl;
}
else
cout <<"File not found " << endl;
file1.close();
}
I hope it's clear .
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如这个问题,您可以做类似的事情:
在您的用例(即格式,所以日期是昨天的日期)的地方。请参阅操作在这里。
至于每天运行它,您必须让一些调度程序为您运行。我在Windows上对此并不熟悉,但是网站似乎就如何设置这样的工作提供了很好的建议。另外,这个问题可能是使用的。
As discussed in this question, you can do something like:
where some things have been adapted for your use case (i.e. format and so the date is of yesterday). See operation here.
As to running it every day you'd have to have some scheduler run it for you. I am not that familiar with this on windows, but this website seems to offer good advice on how you can set up such a job. Alternatively this question, might be of use.