473,395 Members | 1,488 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Polling for a new file in a directory

Hello to everybody!
I have a question concernig to be signalled whet a new file is dumped into a directory.
I currently use a wait loop like

while(!newfile)
{
nfiles = scandir(.....);
if(nfiles == old_nfiles)
usleep(some_time)
else
newfile=true;
}


I do know that this is a dirty wai to do it.
Is there something smarter to do this (in the philosophy of the poll/select command... )
I'm not so well accostumed to file descriptors... sorry!

Many thanks,

Tommaso
Aug 30 '06 #1
3 3445
Sorry guys,
I forgot to mention that I'm working on
Linux Fedora Core 0
using gcc 4.0.0 20050519 (Red Hat 4.0.0-8)

Thanks again!

Tommaso
Aug 30 '06 #2
Banfa
9,065 Expert Mod 8TB
Some operating systems provide a method for the program to request an event on directory update but there is no portable way (i.e. standard C/C++) of doing it.
Aug 30 '06 #3
Banfa
9,065 Expert Mod 8TB
Oh and when posting additional information about athread already opened please post it in the same thread, please do not start another thread.
Aug 30 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Daniel Mueller | last post by:
Hello Fellow Python Programmers, I have the following problem: i want to read the content of a file every 10 seconds. now what is the best funktion to do that? to open the file, read it and...
4
by: Jeremy Moles | last post by:
This is my first time working with some of the more lower-level python "stuff." I was wondering if someone could tell me what I'm doing wrong with my simple test here? Basically, what I need is...
0
by: Vijay Varadan | last post by:
We're using Enterprise Application Block June 2005 w/ Visual Studio 2003 .NET. We've configured our ASP.NET web service to run under a specific domain account using the instructions at...
1
by: Daniel Bass | last post by:
hey guys. overview --------- I'm designing a messaging system that works on the principle of late binding to the I/O objects, depending on the .Net class libraries present in the local folder....
5
by: Mike | last post by:
Hi everyone, I would like to be able to send updates to my web page from the server. If I understood correctly, this is not possible to achieve in a web environment, unless some sort of polling...
3
by: ba.hons | last post by:
Hi all I am new(ish) to c# and was wondering if anyone would help me? I want to create an application that polls a specific directory all the time and when it finds an XML file has been placed...
13
by: LordHog | last post by:
Hello all, I have a little application that needs to poll a device (CAN communications) every 10 to 15 ms otherwise the hardware buffer might overflow when there are message burst on the bus. I...
4
by: sid | last post by:
Can someone tell me how to detect "Action Cancelled" page with out polling. I have a frame set and I want to make sure the other frame is displaying what it is supposed to without polling. For...
3
by: Chris Mullins [MVP - C#] | last post by:
I'm sitting on the fence on this one, and wanted to get some other people's input. If you're a big B2B person, I would love to hear your feedback... I've got a SOA system. It's based on a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
tracyyun
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.