This realpath, after what? Something like this (source for testin the following example):
#include <iostream>
#include <cstdlib>
int main(int argc, char *argv[])
{
char *path = realpath(argv[0], NULL);
std::cout << path << '\n';
free(path);
return 0;
}
Execution Example:
$ ln -s tmp/test
$ ./test
/home/mlil/tmp/test
$
source
share