How to get the fullpath from argument of my application (VS C++ 2005)?
-
My application used to argument (with argv[1]: filename). How to get fullpath from filename via argv[1]. For example, [
myapp.exe input.txt
]. :confused:What's wrong with
fullpath(argv[1]);
?? -
My application used to argument (with argv[1]: filename). How to get fullpath from filename via argv[1]. For example, [
myapp.exe input.txt
]. :confused:I'm assuming that you are passing in the argument so the caller would need to pass it in. Many windows functions look for the file name in the order of current directory then traverse the path. But if you need to get the entire file name that will have to be passed in. If the file is in the current directory you can use findfirstfile findnextfile functions.
a programmer traped in a thugs body
-
My application used to argument (with argv[1]: filename). How to get fullpath from filename via argv[1]. For example, [
myapp.exe input.txt
]. :confused:If you want the fullpath relative to the current working folder you can use the
_fullpath
function as mentioned by W. Kleinschmit. If you want to search for the file and then get the full path of that file you can usePathFindOnPath
API.«_Superman_» I love work. It gives me something to do between weekends.