i'm writing a program in c++ using linux and i face the following issue:
i want to tell the difference between a hard link and a file,given a path.
To be more specific, i consider that it is the file itself when there's only one hard link pointing to the file.If there're more than 1 hard links pointing to the file then i consider the path as a hardlink.I do the following:
struct stat statbuf ;
bool decideHardLink(){
return statbuf.st_nlink>1
}
i cant think of another way to check it ..is this one correct?