使用,而不是argv的“__progname”[0] [英] Using '__progname' instead of argv[0]

查看:474
本文介绍了使用,而不是argv的“__progname”[0]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C / Unix环境下工作,我在,我看到使用__progname代替的argv [0],使用()消息部分开发商。有一些优势呢?什么__progname和argv之间的差[0]。它是便携式?

In the C / Unix environment I work in, I see some developers using __progname instead of argv[0] for usage() messages. Is there some advantage to this? What's the difference between __progname and argv[0]. Is it portable?

推荐答案

__的progname 不标准,因此不便于携带,preFER 的argv [0] 。我想 __的progname 可以查找字符串资源获取是一种不依赖于你运行它作为文件名的名称。但的argv [0] 会给你他们的的名称实际上的运行它作为我会找到更多有用的。

__progname isn't standard and therefore not portable, prefer argv[0]. I suppose __progname could lookup a string resource to get the name which isn't dependent on the filename you ran it as. But argv[0] will give you the name they actually ran it as which I would find more useful.

这篇关于使用,而不是argv的“__progname”[0]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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