Article View: borland.public.cppbuilder.nativeapi
Article #10392Re: FileExists() is using wildcards
From: Remy Lebeau (TeamB)
Date: Tue, 27 Apr 2004 08:33
Date: Tue, 27 Apr 2004 08:33
40 lines
2532 bytes
2532 bytes
"Hans Galema" <dontusethis@dontusethis.nl> wrote in message news:408e0d6a$1@newsgroups.borland.com... > Well if you read my post again then you will see that I reported > that FileExist DOES support wildcards. And that amazes me. The > help does not state it. FileExists would even find Unit1.cpp for > FileName == "*nit.?". Upon further examination, FileExists() calls FileAge(), which in turn calls FindFirstFile(), which then returns the first filename matching the specified mask. FileExists() is not meant to support wildcards, it is merely a side-effect due to Microsoft's own API design. > No I do not need wildcard matching. I need a file exist > function that reports if a file for a filename exists. That is what FileExists() does. > The '?' in my filename was unintentionally, caused by the > fact that the filename was generated by code. Then you will have to validate the filename to see if it contains any invalid characters before then testing for its existance in the file system. Otherwise, stop using buggy generated code in the first place. > The intention of using FileExist was to get a false for > unvalid filenames. To my surprise FileExist does not > care for unvalid filenames, but allows wildcards in them. See my comments above. > Until now, my experience was that FindFirst/FindNext > could NOT be used with wildcards. On the contrary, they are used very often for enumerating the file system specifically using wildcards to find desired files. Gambit
Technical Details
Message-ID:
<408e1c4a$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<408d6cad$1@newsgroups.borland.com> <408d8056$1@newsgroups.borland.com> <408e0d6a$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,8374fb71f8a662f4 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-27 02:09:32 PST From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <408d6cad$1@newsgroups.borland.com> <408d8056$1@newsgroups.borland.com> <408e0d6a$1@newsgroups.borland.com> Subject: Re: FileExists() is using wildcards Date: Tue, 27 Apr 2004 01:33:33 -0700 Lines: 42 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: <408e1c4a$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1083055178 67.22.138.253 (27 Apr 2004 01:39:38 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail