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?
In the C / Unix environment I work in, I see some developers using
Share
__prognameisn’t standard and therefore not portable, preferargv[0]. I suppose__prognamecould lookup a string resource to get the name which isn’t dependent on the filename you ran it as. Butargv[0]will give you the name they actually ran it as which I would find more useful.