fulaphex
fulaphex

Reputation: 3229

Getting existing file handle windows c++

I'm trying to use SetFileTime function to set creation, modification and last access time to times from another file.

Do you know how can I get a file handle of an existing file? I want to iterate over all the files in a directory using FindFirstFile and FindNextFile, but it doesn't give me the handles to all the files, just to the first one.

Upvotes: 0

Views: 3419

Answers (1)

Jabberwocky
Jabberwocky

Reputation: 50883

The handle for SetFileTime must be obtained by opening the file with CreateFile.

The handle returned by FindFirstFile can be used exclusively for subsequent calls to FindNextFile and to FindClose.

Upvotes: 2

Related Questions