Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to get the fullpath from argument of my application (VS C++ 2005)?

How to get the fullpath from argument of my application (VS C++ 2005)?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialc++visual-studioquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nhatvhm
    wrote on last edited by
    #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:

    W K _ 3 Replies Last reply
    0
    • N nhatvhm

      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:

      W Offline
      W Offline
      W Kleinschmit
      wrote on last edited by
      #2

      What's wrong with fullpath(argv[1]); ??

      1 Reply Last reply
      0
      • N nhatvhm

        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:

        K Offline
        K Offline
        ky_rerun
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • N nhatvhm

          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:

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          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 use PathFindOnPathAPI.

          «_Superman_» I love work. It gives me something to do between weekends.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups