12/23/2014 7:51 PM
post112776
|
Just open the path and read() on the fd.
On Mon, Dec 22, 2014 at 06:18:19PM +0530, Akshat Gill wrote:
> Hello,
> I am having trouble understating the nature of realpath() on QNX.
> On Linux realpath("/proc/self/exe", buf) returns the name of the executable
> > real_path (name of the executable)
> >/home/abc/real_path
> while on QNX
> realpath("/proc/self/exefile",buf) returns
> /proc/self/exefile .
> I have attached the sample program for the same. In the program change /exe to
> exefile on QNX.
>
> Regards
> -Akshat
>
> /*
> * Read the contents of the named symbolic links
> */
> #include <limits.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
>
>
> int main( int argc, char** argv )
> {
> char *buf = NULL;
> printf("## The value ::%s\n",realpath("/proc/self/exe", buf ));
>
> return( 0 );
> }
|
|
|