C ++ abstracts file system properties from you, so you have to use system-specific functions.
For Windows, the information you need is in the WIN32_FIND_DATA structure. It can be obtained, for example, with the help of FindFirstFile .
Code from MSDN:
#include <windows.h> WIN32_FIND_DATA FindFileData; HANDLE hFind = FindFirstFile(filename, &FindFileData); if (hFind == INVALID_HANDLE_VALUE) { // обработать ошибку return; } else { // можно пользоваться // не забудьте в конце: FindClose(hFind); }
For the Linux platform, stat (2) provides similar information.
#include <sys/types.h> #include <sys/stat.h> struct stat sb; if (stat(argv[1], &sb) == -1) { // обработать ошибку return; } else { // можно пользоваться }