私はこれまでCを使ったことがありません。このスクリプトは、リスナーをディレクトリに追加し、ターミナルにエコーして、ファイルイベントが発生するたびに終了することでユーザーに通知します。スクリプトを変更して終了せず、代わりにフォルダーの監視を続けたい。キーはこの行かもしれないと思います:
length = read( fd, buffer, BUF_LEN );
しかし、私はここで何が起こっているのか本当に理解していません。関数の説明は、read()
Cを本当によく知っている人にとっておそらく役立つでしょう。
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.
しかし、私はそのカテゴリーに分類されません。