From eb54dc5875f09befc9d968c4b5d04c923017c8c2 Mon Sep 17 00:00:00 2001 From: huangyongan Date: Mon, 24 Apr 2023 13:58:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=80=9A=E8=BF=87=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E8=A1=8C=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 4a63d2c..419184b 100644 --- a/main.cpp +++ b/main.cpp @@ -5,8 +5,7 @@ #define K_VISION_DIR "/hard/k_vision" #define AI_VISION_DIR "/hard/ai_vision" -#define BEGIN_TIME_INTERVAL 8 -#define END_TIME_INTERVAL 12 + std::vector get_file_names(const std::string& strDir) { @@ -110,7 +109,21 @@ std::string cvt_filename_to_datetime(const std::string& strFileName) } -int main() { +int main(int argc, char* argv[]) { + int nParam[2] = {0}; + if (argc != 3) + { + std::cout << "error: input param invalid" << std::endl; + std::cout << "usage: ./ajx_find_files 8 12" << std::endl; + return -1; + } + else + { + nParam[0] = std::atoi(argv[1]); + nParam[1] = std::atoi(argv[2]); + std::cout << "command-line: " << argv[0] << " " << argv[1] << " " << argv[2] << std::endl; + } + auto tt = time(nullptr); auto tm = localtime(&tt); char szSaveDir[255]; @@ -130,7 +143,7 @@ int main() { { ++j; auto datetime = cvt_filename_to_datetime(it); - auto vec_search_path = get_search_paths(it, BEGIN_TIME_INTERVAL, END_TIME_INTERVAL); + auto vec_search_path = get_search_paths(it, nParam[0], nParam[1]); for (auto dir:vec_search_path) { auto vec_file_path = get_file_paths(dir);