Article View: borland.public.cppbuilder.nativeapi
Article #879Re: Cannot retrieve file date
From: Remy Lebeau (TeamB)
Date: Thu, 03 Jan 2008 00:03
Date: Thu, 03 Jan 2008 00:03
44 lines
3137 bytes
3137 bytes
"Jos�" <jose@127.0.0.1> wrote in message
news:qa5on3d6p24qit5hic73bl397a6pg4b9i3@4ax.com...
> Well yes, you are right again. But I am pretty stupid, I do not
> consider reading the documentation of CreateFile() when I do
> not want to create a file.
The documentation for GetFileTime() says the following:
hFile
A handle to the file or directory for which dates and times are to
be retrieved. The handle must have been created using the CreateFile
function with the GENERIC_READ access right. For more
Besides, you posted your original question in the Win32 API newsgroup to
begin with, so you got an answer related to the Win32 API.
> Besides, I always use fopen() to open or create a file.
Like I said earlier, the C runtime (which you are using to open the file in
the first place) has its own functions for retrieving file information -
stat() and fstat(). You can't really mix APIs like you arte attempting. If
you open a file (or any other resource) using the C runtime, then you have
to use the C runtime to work with it. If you open a file/resource using the
Win32 API directly, then you have to use the API to access it.
> Actually, I find it even more stupid to name a function CreateFile()
> if it can be used to open an existing file.
CreateFile() is not creating a file itself. It is creating a "handle" to
the file, so there is always a resource creation occuring. How the handle
interprets the actual file depends on the flags passed to CreateFile().
There MAY be a file creation occuring as well, but only if the function is
told to do that.
The same argument can be said of fopen(), though. It is able to create new
files even though its name suggests it can only open them. There is no
separate fcreate() function. You have to tell fopen() whether you are
opening an existing file or creating a new file. The same applies to
CreateFile().
Gambit
Technical Details
Message-ID:
<477c26ab$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feeder6.cambrium.nl!feed.tweaknews.nl!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<hfonn3l8o175ht0j11i9d4q5msanpr6apt@4ax.com> <477bfc32$3@newsgroups.borland.com> <5p0on3lb068m6ob82jeg8565fmt5e2fsh4@4ax.com> <477c11fb$1@newsgroups.borland.com> <qa5on3d6p24qit5hic73bl397a6pg4b9i3@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,4011bf1b28cc5925 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <hfonn3l8o175ht0j11i9d4q5msanpr6apt@4ax.com> <477bfc32$3@newsgroups.borland.com> <5p0on3lb068m6ob82jeg8565fmt5e2fsh4@4ax.com> <477c11fb$1@newsgroups.borland.com> <qa5on3d6p24qit5hic73bl397a6pg4b9i3@4ax.com> Subject: Re: Cannot retrieve file date Date: Wed, 2 Jan 2008 16:03:41 -0800 Lines: 46 Organization: Lebeau Software X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 NNTP-Posting-Host: 207.178.157.90 Message-ID: <477c26ab$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1199318699 207.178.157.90 (2 Jan 2008 16:04:59 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feeder6.cambrium.nl!feed.tweaknews.nl!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail