In linux, when stat()
is used with broken link files, it fails with -1
. So I used lstat()
which succeeded.
For the same case in windows, _stat()
fails with broken shortcuts, but there is no _lstat()
in windows. Please help to find the alternative for lstat()
in windows.
GetFileAttributes or GetFileAttributesEx probably (if I understood stat
and lstat
right). Quoting from the docs:
Symbolic link behavior—If the path points to a symbolic link, the function returns attributes for the symbolic link.