It isn't usually true that (in C) argv[0] is the path (from the current directory to the executable). You have, typically, to search through the PATH variable in the environment.