[m-rev.] Windows stat() equivalents (was: smart recompilation)

Fergus Henderson fjh at cs.mu.OZ.AU
Wed May 30 02:36:29 AEST 2001


Simon asked me about the Windows equivalents to stat(),
in connection with my comment about his smart recompilation changes.

As well as the Posix-like _stat(), there are also various Win32 primitives
for file attributes and time stamps.   They include FindFirst()/FindNext(),
which unlike Posix readdir() etc. combine finding the files and getting their
attributes, as well as more dedicated routines such as GetFileTime()
and GetFileInformationByHandle().

All the Win32 routines which return file time stamps
return structures containing fields of type `FILETIME':

 | FILETIME
 | The FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601. 
 | 
 | typedef struct _FILETIME { 
 |     DWORD dwLowDateTime; 
 |     DWORD dwHighDateTime; 
 | } FILETIME, *PFILETIME; 

Note that this won't fit in a Mercury int on a 32-bit machine.

For .NET there is the System.DateTime class, which includes a "Ticks"
read-only property (i.e. a getTicks() method) which converts to a 64-bit
int, equivalent to the Win32 FILETIME.  System.DateTime() also supports
ToString() and FromString().

P.S.
The documentation is available on http://www.msdn.microsoft.com.
You can probably find it by just searching for the right keywords
(that's how I found it), but for reference it's under

    * for the win32 stuff:
	- Platform SDK Documentation
	  - Base Services
	    - Files and I/O
	      - File I/O
	        - About File I/O
		  - Getting information about files
		    - File Date and Time
		- etc.

    * for the .NET stuff:
    	- .NET beta documentation
	  - .NET framework reference
	    - System
	      - DateTime structure
	      - System.IO
	        - File Class
	        - Directory Class
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list