argc is the number of strings in the
argv array. argv[0] is always the name of the executable program and will never ever contain a command-line argument.
>>argv[i] + 3
all that does is bypass the first 3 characters of the ith string.
The algorithm you posted doesn't work at all if you put a space between "/id" and whatever is supposed to follow. For example, if you typed this:
c:\myprogram /id something <Enter key>
In the above the program will get two command-line arguments, not one. argv[1] will be "/cd" and argv[2] will be "something". And that will break the algorithm you posted.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Offline 21,957 posts
since Aug 2005