LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 05-15-2004, 06:48 AM   #1
nodger
Member
 
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
Code:
struct stat
definition, and theres the
Code:
st_nlink
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
ekman
Member
 
Registered: Apr 2004
Location: Sweden
Posts: 41

Rep: Reputation: 15
Hello,
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".

Regards,
L Ekman
 
  


Reply


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 10:22 AM.

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