lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Dec 18, 2009 at 12:01 AM, Sean Conner <sean@conman.org> wrote:
>  Under MS-DOS (and I assume, Windows), you have the following:
>
>        FindFirstFile()  - return first file in current working directory
>        FindNextFile()   - return the next matching file
>
>  FindFirstFile() only works for the current working directory (unlike
> Unix), it takes a simple file regex (a file glob) and some flags (include
> archive files, read-only files, system files, etc) and fills in a structure
> (the address of which is passed in first via another function) with the
> following information (for Unix, another all is needed to obtain this
> information):
>
>        name
>        extention       (note: Unix does not use extentions---applications
>                        might, but not the OS itself)
>        timestamp
>        filesize
>        attribute       (hidden, system, read-only, etc)

Your assumption is incorrect - under Windows things are slightly
different (read
http://msdn.microsoft.com/en-us/library/aa364418%28VS.85%29.aspx):
FindFirstFile() works for any directory, does not take any flags, and
takes the address of the structure directly. Said structure then
contains:
* attributes
* multiple timestamps (creation time, access time, write time)
* filesize
* filename
And of course, don't forget FindClose() to clean things up.