flat assembler
Message board for the users of flat assembler.
Index
> Linux > Determining executable's directory |
Author |
|
f0dder 19 May 2005, 19:34
Hmm, I saw a post about this on a game developing oriented site a while ago (probably flipcode?), and it seemed that it was all but a trivial task. There was even a developer from loki soft (I think) who griped about it...
|
|||
19 May 2005, 19:34 |
|
ronware 19 May 2005, 19:46
Yeah, I was thinking I could probably get it out of /proc ... I really don't want to do that if I don't have to.
|
|||
19 May 2005, 19:46 |
|
ronware 19 May 2005, 20:12
In fact, /proc/<yourpid>/exe is a symlink to the executable. Now does anyone know just how to resolve a symlink to the file it points to? I know it's not hard, I just don't know how to do it
|
|||
19 May 2005, 20:12 |
|
ronware 19 May 2005, 20:15
The 'net is great! "readlink" is the function.
First 'getpid' to get your process id, then readlink on '/proc/yourpid/exe' and you're done. 'readlink' returns the length of the string return, or -1 on failure. |
|||
19 May 2005, 20:15 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.