How do I get the file size and date stamp of a file on Windows in C++, given its path?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
FindFirstFile()to get them both at once, without having to open it (which is required byGetFileSize()andGetInformationByHandle()). It’s a bit laborious, however, so a little wrapper is helpfulThen the file size is available in the
nFileSizeHighandnFileSizeLowmembers of WIN32_FIND_DATA, and the timestamps are available in theftCreationTime,ftLastAccessTimeandftLastWriteTimemembers.