I had this bite me in a certain sensitive spot this evening, and would like some clarification. As karlphillip said in this question, the executable sees the argument list as
Consider: ./program file.txt
argv[0] is "program"
argv[1] is "file.txt"
However, in the gdb debugger, for the program ./lc1 f1.txt
, the arglist shows as
arg[0] is "/home/jason/Project 6/lc1"
arg[1] is "lc1"
arg[2] is "f1.txt"
Why the discrepancy between the two arglists?