mardi 30 août 2016

lstat doesn't detect symbolic link

I'm trying to check if a file is a symbolic link, my test doesn't seem to work. How can I check for symbolic links?

if (lstat(file->full_path, &file_info) == 0)
    printf((file_info.st_mode & S_IFDIR)  ? "l" : "");
else
    printf((S_ISDIR(file_info.st_mode))  ? "d" : "-");

Aucun commentaire:

Enregistrer un commentaire