Prof. Falken
Prof. Falken

Reputation: 24937

Canonical way to check file size in Windows API?

Is there a canonical way to check the size of a file in Windows? Googling brings me both Find­First­File and GetFileSizeEx but no clear winner. And must GetLastError always be called too?

Upvotes: 2

Views: 243

Answers (1)

Jerry Coffin
Jerry Coffin

Reputation: 490663

If you just want the size, the GetFileSizeEx is the clear winner. Yes, FindFirstFile will do the job too, but it's really intended for other purposes, and unless you need to do those other things, its use is likely to mislead or confuse the reader.

Upvotes: 2

Related Questions