Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4618432
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:15:57+00:00 2026-05-22T02:15:57+00:00

In Linux, if you have a path to a file which you know is

  • 0

In Linux, if you have a path to a file which you know is a symlink, how do you programmatically determine (in C or C++) the path to the file that it points to?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:15:58+00:00Added an answer on May 22, 2026 at 2:15 am

    The readlink function. Do a man 2 readlink. This function is part of the Posix API, so it should work on almost any Unix.

    If the path starts with a '/', then its an absolute symlink and you have the full absolute path of the file to which it refers (which may be another symbolic link, and you’ll have to repeat the process again).

    If the path does not start with ‘/‘, then it’s a relative link and is interpreted relative to the directory the symlink is in. It’s up to you to combine the path appropriately to figure out the real filename.

    Of course, sometimes symlinks are used to store information that’s not actually a path. Sometimes programs store a PID or other such information in them for locking purposes. The calls to create a symlink are one of the more reliably atomic operations that can be performed on an NFS mounted filesystem.

    Also, on my Fedora system, if you do man 7 symlink you get a long discussion of symlinks, their behavior in various circumstances and a rundown of the functions that manipulate them or are affected by them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have string variable which represents the full path of some file, like: x
I have a file download script that I have written, which reads files from
We have a Linux server application that is comprised of a number of open-source
We have a Linux application that makes use of OpenSSL's Python bindings and I
We have 10 Linux boxes that must run 100 different tasks each week. These
On a Linux system I have a binary (bin.exe) which needs to read an
I have a file called generator.php that uses fwrite() to create a result.php on
I have Linux, PHP installed. I want to set the cron job which will
In my class I have FILE* ascii_file; data member, which always is initialized via
see i have make one program which create one new file just using fopen()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.