Tests whether a given path is a symbolic link
Download (right click, save as, rename as appropriate)
1 2 3 4 5 6 7
#include <sys/stat.h> /* Returns 1 if the path is a symlink, 0 if it's not, and -1 on error */ int issymlink(const char* path) { struct stat dat; return lstat(path, &dat) == 0 ? S_ISLNK(dat.st_mode) : -1; }