[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.
This commit is contained in:
Kirigaya Kazuto 2017-03-29 19:39:48 +08:00
parent b5d39b7b86
commit 9c953fc2f9

View File

@ -403,9 +403,13 @@ int main()
if(pack.second<3) if(pack.second<3)
{ {
printf("重新获取失败多次,停止获取ID: %d.\n",id);
needrefetch.push(make_pair(id,pack.second+1)); needrefetch.push(make_pair(id,pack.second+1));
} }
else
{
printf("重新获取失败多次,停止获取ID: %d.\n",id);
}
} }
else else
{ {
@ -417,13 +421,13 @@ int main()
printf("解析完成.\n"); 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; string fname;
printf("请输入保存文件名称,时间将会自动追加到结尾,后缀名为txt\n"); printf("请输入保存文件名称,时间将会自动追加到结尾,后缀名为txt\n");
getline(cin,fname); getline(cin,fname);
fname=string("result/")+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(gpbuff);
fname.append(".txt"); fname.append(".txt");
printf("正在保存到 %s\n",fname.c_str()); printf("正在保存到 %s\n",fname.c_str());