-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexample.c
53 lines (43 loc) · 1.14 KB
/
example.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "x-watcher.h"
void callback_func(XWATCHER_FILE_EVENT event,
const char *path, int context, void *data) {
switch(event) {
case XWATCHER_FILE_UNSPECIFIED:
printf("Unspecified event for ");
break;
case XWATCHER_FILE_CREATED:
printf("File creation event for ");
break;
case XWATCHER_FILE_REMOVED:
printf("File removal event for ");
break;
case XWATCHER_FILE_OPENED:
printf("File open event for ");
break;
case XWATCHER_FILE_ATTRIBUTES_CHANGED:
printf("File attribute changed event for ");
break;
case XWATCHER_FILE_MODIFIED:
printf("File modification event for ");
break;
case XWATCHER_FILE_RENAMED:
printf("File renaming event for ");
break;
default:
printf("Unhandled event for ");
break;
}
printf("%s with context %d\n", path, context);
}
int main(int argc, char *argv[]) {
x_watcher *watcher = xWatcher_create();
xWatcher_reference dir;
dir.path = argc > 1 ? argv[1] : "C:\\Users\\nikp123\\Desktop\\asdf.txt";
dir.callback_func = callback_func;
dir.context = 1;
xWatcher_appendFile(watcher, &dir);
xWatcher_start(watcher);
getchar();
xWatcher_destroy(watcher);
return 0;
}