Article View: borland.public.cppbuilder.nativeapi
Article #11705Re: ReadDirectoryChangesW and use of the filename it provides
From: Remy Lebeau (TeamB)
Date: Mon, 19 Jan 2004 21:19
Date: Mon, 19 Jan 2004 21:19
39 lines
2519 bytes
2519 bytes
"Daryl" <stockd@tpg.com.au> wrote in message
news:4009b11a@newsgroups.borland.com...
> The problem is when I want to immediately use the file that
> has been copied, if I say want to open and parse the file I
> use the following code:
Please show your actual monitoring code. You have only shown a snippet that
has nothing to do with the issue being asked about.
> //Check to see if file exists
> if (!ifs) {
> WriteToLog("File " + "full_path_to_file" + " does not exist.");
> return;
> }
You are making an assumption about the error. Opening the file could fail
for any number of reasons, not necessarily because the file doesn't exist.
> My problem is that although I get notification of every
> file that is placed into the monitored directory (I simply
> set the directory to monitor and then drag and drop a file
> to it) I only get a handle to the first file (using ifstream
> ifs("full_path_to_file", ios::in);). All subsequent files added
> to the directory will not be processed - Why?
How are you determining the filenames to begin with? Probably, a
notification can contain multiple filenames and you are simply not looping
through them correctly? You have not shown enough code yet to see whether
you are handling the notifications correctly to begin with.
> It appears that they do not exist in the directory (I use the
> full path to the file). I know this by the statement if (!ifs) failing.
Again, that is not an indication of the files' existance or not.
Gambit
Technical Details
Message-ID:
<400c484b$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4009b11a@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,a51981ecec0a9c82 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-01-19 13:22:05 PST From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4009b11a@newsgroups.borland.com> Subject: Re: ReadDirectoryChangesW and use of the filename it provides Date: Mon, 19 Jan 2004 13:19:12 -0800 Lines: 41 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 67.22.138.253 Message-ID: <400c484b$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1074546763 67.22.138.253 (19 Jan 2004 13:12:43 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail