Hey everyone,
Is there a way to "watch" a file for changes? I know I could poll the
file every few seconds and check to see if the buffer has changed but
is there a cleaner way?
thanks!
Ben 5 1614
"Benjamin D. LeMasurier" <ui*****@uidzer 0.org> wrote in message
news:9c******** *************** ***@posting.goo gle.com... Hey everyone,
Is there a way to "watch" a file for changes?
I assume you mean changes made by some other process.
Otherwise your program already 'knows' when it changes
things.
I know I could poll the file every few seconds and check to see if the buffer has changed but is there a cleaner way?
Depending upon your operating system, probably yes. But
standard C doesn't recognize the notion of multiple processes,
shared files, etc. Those issues are the domain of the operating
system. Ask in a forum which discuss your host platform.
-Mike
"Benjamin D. LeMasurier" <ui*****@uidzer 0.org> wrote in message
news:9c******** *************** ***@posting.goo gle.com... Hey everyone,
Is there a way to "watch" a file for changes? I know I could poll the file every few seconds and check to see if the buffer has changed but is there a cleaner way?
Depends on your OS. AFAIK, there is no standard 'C' way to do it. On a POSIX
system, stat() and check atime.
thanks!
Ben
"dandelion" <so*******@mead own.net> writes: "Benjamin D. LeMasurier" <ui*****@uidzer 0.org> wrote in message news:9c******** *************** ***@posting.goo gle.com... Hey everyone,
Is there a way to "watch" a file for changes? I know I could poll the file every few seconds and check to see if the buffer has changed but is there a cleaner way?
Depends on your OS. AFAIK, there is no standard 'C' way to do it. On a POSIX system, stat() and check atime.
<OT>
mtime, not atime. For details, consult the documentation or an
appropriate newsgroup.
</OT>
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
"dandelion" <so*******@mead own.net> wrote in message news:<415d286d$ 0$147 Depends on your OS. AFAIK, there is no standard 'C' way to do it. On a POSIX system, stat() and check atime.
I am in a linux/unix environment. I will give stat() a try
thanks!
Ben
"Keith Thompson" <ks***@mib.or g> wrote in message
news:ln******** ****@nuthaus.mi b.org... "dandelion" <so*******@mead own.net> writes: "Benjamin D. LeMasurier" <ui*****@uidzer 0.org> wrote in message news:9c******** *************** ***@posting.goo gle.com... Hey everyone,
Is there a way to "watch" a file for changes? I know I could poll the file every few seconds and check to see if the buffer has changed but is there a cleaner way?
Depends on your OS. AFAIK, there is no standard 'C' way to do it. On a
POSIX system, stat() and check atime.
<OT> mtime, not atime. For details, consult the documentation or an appropriate newsgroup. </OT>
<ot>
Right of course. Errare humanum est.
</ot> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Christopher Harrison |
last post by:
I would like to, cleanly, watch a flat file for changes (updates and
the like). The file will be altered by another program... I found some
example code (which actually didn't compile) on Google, but it
essentially does it the way I would have in the first place (i.e. sets
up a loop and gets the file's attributes each iteration, comparing to
the previous instance). This seems kind of cludgy to me: is there a
better way?
Thank you :)...
|
by: Ajay Pal Singh |
last post by:
Hi,
I am creating a web service, which needs to take some actions based on the
config file. I need a way to listen the changes as they occur in the config
file so that the service can take appropriate action for the cahnges. Is
there any way i can implement this.
Thanks,
Ajay
|
by: Claire |
last post by:
Im sat here watching task manager and the memory consumption of my
application rising second by second.
What tools are there out there for me to use to find where it's all going
please?
(I wish we were able to do garbage collection ourselves. Excruciatingly poor
idea microsoft. That's been the most annoying part of dotnet)
Ive looked at some web pages talking about using the gc class to force
garbage collection. Is this something that can...
|
by: aure_bobo |
last post by:
Hi all,
I'm currently developing an ASP.NET 1.1 C# Webapp.
I have some objects which contains the differents parameters of my web
app.
These objects are instanciated in my code, in a static way...
I would like to create an XML file which will store the different
parameters of my webapp.
|
by: Stu |
last post by:
Hi,
I have been asked to interface with an AIX system running a COBOL
application. Not having done this before we settled on text files written to
a drive to communicate between the two systems.
Firstly, does anyone know of a better (less nasty!) way of communication
between COBOL and .Net over a local network.
Secondly, if we go ahead with the text file method - would the built in
| |
by: Gordon Airporte |
last post by:
I'm trying to find a way to take a file that another program has opened
and writes to periodically, open it simultaneously in Python, and
automatically update some of my objects in Python when the file is
written to.
I can open the file and manually readlines() from it to keep up to date,
it's the automatic part I'm having trouble with. This is on Windows.
|
by: jcor |
last post by:
Can anyone give me some help, plz
I want to create a perl script to be watching a folder.
Everytime a new file gets there it triggers some code;
How can I do this?
TIA,
João Correia
|
by: Zed A. Shaw |
last post by:
Hi Everyone,
Just putting out an announcement that I've released a new version of
Vellum numbered 0.16. This version should be ready for people to use
as not much of the internal structure has changed in a great many
commits and it contains all the latest bug fixes.
It also has the beginning of an extensive PDF document describing how
to use it. This is still an in-progress work, so it has grammar
mistakes and spelling errors, but...
|
by: Andrew Cooper |
last post by:
I've got an application that I'm modifying and the client needs it to
watch a particular file and then do some stuff when that file gets
modified. For example, let's say the file is C:\Test.dat and that it
looks like this...
AcctNum, 500
SomeValue, 4500
Periodically there is another program that changes the Test.dat file
values. The application I'm modifying needs to detect that the Test.dat
|
by: canabatz |
last post by:
Hi all
i got a page that is refreshing data in a grid every 4 seconds and displaying results from the database and check if something as changed!
my question is if there is 100 users that is watching the page and in some times living the page and viewing some other web sites!! ,the problem is that they eating my bandwidth for nothing!!
there is a code that can stop the refreshing if they are not watching my page?
thanks in advanced !
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |