You could always parse ls -l or something . . . .
. . . or, if you can convince "open" or whatever not to follow symbolic links, you could just read the file directly.
Printable View
Ok, so you probably need to use opendir()/readdir()/closedir() to open/read/close the directory entry then. Unfortunately, you won't be able to spawn a process and use something like a "ls | awk ..." or "ls | sed ...", since you would then get the path to "ls", rather than your application, which I assume is what you are actually after [although I suppose the stuff is also in a numbered process /proc/<pid>/exe (or similar) directory, so I suppose that would be possible to use for such scripting tricks].
Edit: Note that you would have to do (pseudo-code)Code:x = opendir("\proc\self");
while(readdir(dirinfo))
{
if (dirinfo.fname == "exe")
{
getlinkcontent();
break;
}
}
closedir(x);
--
Mats