0

I know you can theoretically pass anything you want to the application, so why include the applications name there, as it isn't even a safe way to check it?

It doesn't seem like there would be any use to it.

CodenameLambda
  • 1,454
  • 11
  • 23
  • 2
    http://unix.stackexchange.com/questions/315812/why-does-argv-include-the-program-name – tkausl Oct 17 '16 at 22:04
  • @tkausl thanks! I think that solves it ^^ – CodenameLambda Oct 17 '16 at 22:18
  • Possible duplicate of [Is "argv\[0\] = name-of-executable" an accepted standard or just a common convention?](https://stackoverflow.com/questions/2050961/is-argv0-name-of-executable-an-accepted-standard-or-just-a-common-conventi) – Cody Gray Jul 14 '17 at 19:05

1 Answers1

1

It can be useful to find out how the program was called. You may have multiple symlinks to the same file, and argv[0] can be used to determine how the program was invoked.

K Richardson
  • 1,500
  • 1
  • 9
  • 14