cnd
cnd

Reputation: 33784

how to get running application path on linux?

To get current directory I found :

  if (!getcwd(cCurrentPath, sizeof(cCurrentPath) / sizeof(char))) {
    lililog.log(LILILog::error,"Error getting current directory path");
  }

But I need to get directory of running application. How to make it?

Upvotes: 1

Views: 1440

Answers (1)

Ringding
Ringding

Reputation: 2856

Very nonportable solution: read the symlink /proc/self/exe.

Upvotes: 2

Related Questions