获得完整的申请途径 [英] get full path of application

查看:68
本文介绍了获得完整的申请途径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我现在很困惑。我如何获得应用程序的完整路径?


如果myapp位于属于PATH的目录中,argv [0]首先给我

cmd行的标记,而不是执行的

程序的真实路径。


所以,如果我在任何地方写:


%myapp


它从文件中运行正常(例如)/ usr / local / bin / myapp


但是argv [ 0]给我回报


../myapp


但我需要


/ usr / local / bin / myapp


提前感谢

hi all,

i''m confused now. how i can get the full path of an application?

if myapp is in a directory which belongs to PATH, argv[0] gives me the
first token of cmd line, and not the real path of the executed
program.

so if i write anywhere:

% myapp

it runs ok from the file (for example) /usr/local/bin/myapp

but argv[0] returns me

../myapp

but i need

/usr/local/bin/myapp

thanks in advance

推荐答案

rh00667写道:
rh00667 wrote:

大家好,


我现在很困惑。我怎样才能获得应用程序的完整路径?
hi all,

i''m confused now. how i can get the full path of an application?



你不能。

You can''t.


3月6日下午2:41,Rolf Magnus< ramag ... @t-online.dewrote:
On Mar 6, 2:41 pm, Rolf Magnus <ramag...@t-online.dewrote:

你不能。
You can''t.



哇!任何提示?


或者我必须navegate PATH找到第一个pathdir / myapp ??????

wow! any hint?

or must i navegate PATH finding the first pathdir/myapp ??????


3月6日下午2:41,Rolf Magnus< ramag ... @ t-online.dewrote:
On Mar 6, 2:41 pm, Rolf Magnus <ramag...@t-online.dewrote:

你不能。
You can''t.



哇!任何提示?


或者我必须navegate PATH找到第一个pathdir / myapp ??????

wow! any hint?

or must i navegate PATH finding the first pathdir/myapp ??????


这篇关于获得完整的申请途径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆