C
C Guy
The function signature for main is:
int main (int argc, char *argv[], char **envp)
argc tells you how many argv[] there are.
argv[0] is the name of the executable - the name of the executable
containing main().
Under Win-XP, I've noticed that argv[0] does not include the full
filespec when invoked within a command shell. By filespec, I mean the
full path and the full name of the program file - including suffix (ie -
..exe).
What I am seeing in argv(0) is just the file stem - as typed by the
user.
Eg, from a command shell, if I invoke "example" from c:\hello\there\, I
am seeing argv[0] return simply "example". In other words, exactly what
the user typed, not the full and complete filespec.
If I perform the same command in, say, a command prompt in win98,
argv(0) returns "c:\hello\there\example.exe" (the full and complete
filespec).
Maybe I'm dreaming, but I could swear that once upon a time that from a
command prompt on XP that I would see the same thing as I see on win98.
When launched from explorer (under XP) argv(0) seems to behave as I
expect.
Did XP always exhibit this behavior?
How does NT and 2K behave in this regard?
int main (int argc, char *argv[], char **envp)
argc tells you how many argv[] there are.
argv[0] is the name of the executable - the name of the executable
containing main().
Under Win-XP, I've noticed that argv[0] does not include the full
filespec when invoked within a command shell. By filespec, I mean the
full path and the full name of the program file - including suffix (ie -
..exe).
What I am seeing in argv(0) is just the file stem - as typed by the
user.
Eg, from a command shell, if I invoke "example" from c:\hello\there\, I
am seeing argv[0] return simply "example". In other words, exactly what
the user typed, not the full and complete filespec.
If I perform the same command in, say, a command prompt in win98,
argv(0) returns "c:\hello\there\example.exe" (the full and complete
filespec).
Maybe I'm dreaming, but I could swear that once upon a time that from a
command prompt on XP that I would see the same thing as I see on win98.
When launched from explorer (under XP) argv(0) seems to behave as I
expect.
Did XP always exhibit this behavior?
How does NT and 2K behave in this regard?