Skip to content

Commit e8363ae

Browse files
Update file_owl.cpp
#2 fixed >> ./Linux-File-Owl <directory_to_watch> <CSV file to save>
1 parent 8ef24cf commit e8363ae

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/file_owl.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff 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

8583
int 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();

0 commit comments

Comments
 (0)