From 9c953fc2f9211767ff43a8df78c0af008d44b38c Mon Sep 17 00:00:00 2001 From: Kiritow <1362050620@qq.com> Date: Wed, 29 Mar 2017 19:39:48 +0800 Subject: [PATCH] [Fix Bugs] Refetch Status and time string of Saved File Bug of refetch: if an id is unreachable, the error message will be printed 3 times. Now we have fixed it and it will only be shown 1 time. Bug of time string: if data has been generated but you don't enter filename in time, the file will be saved with a time string of the moment you enter the filename. Now the time string will be generated before you entering filename. --- main.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index df64676..108a811 100644 --- a/main.cpp +++ b/main.cpp @@ -403,9 +403,13 @@ int main() if(pack.second<3) { - printf("重新获取失败多次,停止获取ID: %d.\n",id); needrefetch.push(make_pair(id,pack.second+1)); } + else + { + printf("重新获取失败多次,停止获取ID: %d.\n",id); + } + } else { @@ -417,13 +421,13 @@ int main() printf("解析完成.\n"); + s_time now=whattime(); + char gpbuff[1024]; + sprintf(gpbuff,"-%04d%02d%02d-%02d%02d%02d",now.year,now.mon,now.day,now.hour,now.min,now.sec); string fname; printf("请输入保存文件名称,时间将会自动追加到结尾,后缀名为txt\n"); getline(cin,fname); fname=string("result/")+fname; - s_time now=whattime(); - char gpbuff[1024]; - sprintf(gpbuff,"-%04d%02d%02d-%02d%02d%02d",now.year,now.mon,now.day,now.hour,now.min,now.sec); fname.append(gpbuff); fname.append(".txt"); printf("正在保存到 %s\n",fname.c_str());