/* monitorfile * * Small example application which tries to mimic "tail -f". * (Note: It does not begin with the last 10 lines as tail does.) * * It demonstrates the use of the filesystem::file_monitor class. */ /* Note: Do not include config.h in your own programs. See README. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include using namespace std ; int main (int argc, char** argv) { if (argc != 2) { cerr << "Usage: monitorfile /some/filename" << endl ; return -1 ; } string filename (argv[1]) ; filesystem::file_monitor fmon (filename) ; fmon.seekToEnd () ; while (true) { while (fmon.isReady ()) { cout << fmon.getLine () << endl ; } usleep (100) ; } return 0 ; }