Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 05-15-2004, 06:48 AM   #1
Registered: Oct 2003
Location: Ireland
Distribution: Slackware 9.1, Ubuntu
Posts: 192

Rep: Reputation: 30
Hard/Soft Links

This may belong in the programming forum, but its also (kind of) a general question.

I am trying to write some (c) code that will enable me to check if a directory entry is a link or not.

I had a look at the
struct stat
definition, and theres the
member, but I don`t think this is what I`m looking for. Im not sure whether to use the stat or the lstat function.

I`d like some advice on this as I have never worked with links before. Thanks
Old 05-15-2004, 10:36 AM   #2
Registered: Apr 2004
Location: Sweden
Posts: 41

Rep: Reputation: 15
If you have used "stat" you have probably read the "man 2 stat" page, but
maybe missed the "S_ISLNK(m)" macro which you use with the "st_mode" field
in the "struct stat". That is probably what you are looking for.
And you should use the "stat" function not "lstat".

L Ekman


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
links (hard links and soft links..) sachitha Programming 1 08-10-2005 12:10 PM
Soft Links varunbihani Linux - Newbie 3 06-04-2005 11:42 PM
Soft vs. Hard Links jrdioko Linux - Newbie 2 06-13-2004 02:41 PM
Soft Links tonphi Red Hat 1 09-22-2003 09:20 PM
Soft Links Resqtech Linux - Newbie 4 08-26-2001 10:00 AM

All times are GMT -5. The time now is 02:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration