filename argument

My program needs to accept a filename as a command line argument. If the user enters

 
myprog.exe file1.txt

I can pull the path out of argv[0], and then add argv[1], and the file opens just fine. I don't want to just assume that the input file is in the same dir as the executable.I would like the user to be able to enter:

 
myprog.exe c:\myfiles\file1.txt

Unfortunately, now argv[0] doesn't contain the correct path, but argv[1] does. How would I reconcile these two different situations?
If you don't specify the path when opening a file, it will be relative to the working directory of your program
So you can use file1.txt to open whatever directory your program is in/file1.txt
Topic archived. No new replies allowed.