I've never used C before. this script adds a listener onto a directory and notifies the user by echoing to the terminal and then exiting whenever a file event happens. I want to modify the script to NOT exit but instead continuing monitoring the folder. I think the key might be this line:
length = read( fd, buffer, BUF_LEN );
but I don't really understand what is going on here. The description of the read()
function is probably helpful for those who know C really well:
Using inotify is simple: Create a file descriptor, attach one or more watches (a watch is a path and set of events), and use the read() method to receive event information from the descriptor. Rather than burn scarce cycles, read() blocks until events occur.
but I don't fall into that category.