File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -58,8 +58,6 @@ void write_to_csv(const std::string& csv_file) {
5858 return ;
5959 }
6060
61-
62-
6361 std::ofstream ofs (csv_file, std::ios_base::app); // Append mode
6462 if (!ofs.is_open ()) {
6563 std::cerr << " Failed to open CSV file: " << csv_file << std::endl;
@@ -83,12 +81,12 @@ void periodic_flush(const std::string& csv_file) {
8381}
8482
8583int main (int argc, char * argv[]) {
86- if (argc < 2 ) {
87- std::cerr << " Usage: " << argv[0 ] << " <directory_to_watch>" << std::endl;
84+ if (argc < 3 ) {
85+ std::cerr << " Usage: " << argv[0 ] << " <directory_to_watch>" << " <CSV file to save> " << std::endl;
8886 return EXIT_FAILURE;
8987 }
90- const std::string directory_to_watch = argv[1 ]; // Get the directory to watch from command-line argument
91- const std::string csv_file = " file_operations.csv " ;
88+ const std::string directory_to_watch = argv[1 ];
89+ const std::string csv_file = argv[ 2 ] ;
9290
9391 // Create an inotify instance
9492 int fd = inotify_init ();
You can’t perform that action at this time.
0 commit comments