How do you determine using stat() whether a file is a symbolic link?

后端 未结 1 971
攒了一身酷
攒了一身酷 2020-12-06 10:10

I basically have to write a clone of the UNIX ls command for a class, and I\'ve got almost everything working. One thing I can\'t seem to figure out how to do is check wheth

相关标签:
1条回答
  • 2020-12-06 10:53

    You can't.

    You need to use lstat() to stat the link itself, plain stat() will follow the link, and thus never "see" the link itself.

    0 讨论(0)
提交回复
热议问题