Operating System - HP-UX
1838407 Members
2993 Online
110125 Solutions
New Discussion

Interrogating Symbolic Links using stat(2)

 
SOLVED
Go to solution
FRED Dennison
Advisor

Interrogating Symbolic Links using stat(2)

Am writing a C program that uses stat to retrieve the File Size. Whenever I try this on a symbolic link, I get the File Size of the File that is linked to, not the size of the Link itself.

How would I get around this?
Peace thru superior firepower.
2 REPLIES 2
James A. Donovan
Honored Contributor
Solution

Re: Interrogating Symbolic Links using stat(2)

See lstat(2). This function returns the "size" of the symbolic link (the length of the path to the real file) in the st_size member.
Remember, wherever you go, there you are...
FRED Dennison
Advisor

Re: Interrogating Symbolic Links using stat(2)

Fantastic, works a charm!

Thanks
Peace thru superior firepower.