From 49ef7423a6c6854e12ac074bfa4d2ed137ca60a1 Mon Sep 17 00:00:00 2001 From: Kiritow <1362050620@qq.com> Date: Wed, 22 Mar 2017 16:48:01 +0800 Subject: [PATCH] Add time support in System. --- main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 515e4e5..e923fc7 100644 --- a/main.cpp +++ b/main.cpp @@ -10,13 +10,11 @@ #include #include #include -#include +#include using namespace std; - - double parseValue(string Filename) { printf("Filename : %s\n",Filename.c_str()); @@ -169,8 +167,12 @@ int main() printf("解析完成.\n"); string fname; - printf("请输入保存文件名称...\n"); + printf("请输入保存文件名称,时间将会自动追加到结尾,后缀名为txt\n"); getline(cin,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+=".txt"; printf("正在保存到 %s\n",fname.c_str()); ofstream ofs(fname);