Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 261233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:24:53+00:00 2026-05-11T22:24:53+00:00

I am currently watching an XML file from log4j output. I have a custom

  • 0

I am currently watching an XML file from log4j output. I have a custom viewer that displays the log-output in GUI. I need to watch this file as to when it gets updated so that the GUI can re-parse and update itself. In C# there is a FileWatcher concept so on Windows no-probs, but what options do i have using C on Linux.

Is there a standard way of doing this on both unix and linux flavours (POSIX maybe)?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:24:53+00:00Added an answer on May 11, 2026 at 10:24 pm

    John mentioned the two main routes you can take for watching files under Unix/Linux systems: notification and polling.

    Notification is when the system itself (usually the kernel) triggers a message to registered applications whenever the file is accessed or written to. This approach requires a compliant system and might not be available on older machines.

    The primary implementation of notification under Linux is inotify, which is built into kernels 2.6.13 and later and can be patched into 2.6.12 and earlier. There’s a nice IBM guide on using inotify as well as a basic set of tools and C library for accessing inotify.

    Polling is when your program repeatedly checks a file at intervals to see if anything about that file – its size, last modification time, owner, etc. – has been changed.

    There’s no standard implementation of this, as it’s written on a program-level rather than system-level basis, although the system call poll exists and seems to do something useful for this purpose (the man page says it’s similar to select, and it waits for an event to become available on a file descriptor). You could also take the more basic approach with stat and do your checking on your own.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently watching my log files like this tail -f and every now and
Currently I have a class that looks like this: public class MyClass : IMyClass
Currently we're parsing arp request output from the command line. string cmd = arp
I am currently watching the 80 minute ASP.NET MVC introduction. Automatically generating views from
I am currently watching a video from 27C3 and I would like to filter
I am currently watching tutorial videos on ASP .NET MVC 3 and have come
Currently the HashSet<T> constructor that allows you to define your equality comparison yourself is
Currently I have a DetailsView attached to a GridView. When you select an item
I'm currently listening and watching to iPad / iPhone application development and working assignments/demo.
I recently watching this video on Google Chrome with great interest. It explains that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.