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. Is there an API to return parent directory

Is there an API to return parent directory

Scheduled Pinned Locked Moved C / C++ / MFC
json
5 Posts 3 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.
  • P Offline
    P Offline
    Parthi_Appu
    wrote on last edited by
    #1

    Hi All, Say if i give, C:\\Level 1\\Level 2\\abc.txt, the return value i'm expecting is C:\\Level 1\\Level 2. Is there an API to return the parent directory from the given path, something like PathFindFileName API, or we should extract on our own. Thanx.


    Do your Duty and Don't expect the Result

    P V 2 Replies Last reply
    0
    • P Parthi_Appu

      Hi All, Say if i give, C:\\Level 1\\Level 2\\abc.txt, the return value i'm expecting is C:\\Level 1\\Level 2. Is there an API to return the parent directory from the given path, something like PathFindFileName API, or we should extract on our own. Thanx.


      Do your Duty and Don't expect the Result

      P Offline
      P Offline
      Perspx
      wrote on last edited by
      #2

      If you're given a full pathname, just get rid of everything after the last \\ :) Regards, --Perspx

      "The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia Introduction to Object-Oriented JavaScript

      1 Reply Last reply
      0
      • P Parthi_Appu

        Hi All, Say if i give, C:\\Level 1\\Level 2\\abc.txt, the return value i'm expecting is C:\\Level 1\\Level 2. Is there an API to return the parent directory from the given path, something like PathFindFileName API, or we should extract on our own. Thanx.


        Do your Duty and Don't expect the Result

        V Offline
        V Offline
        vikas amin
        wrote on last edited by
        #3

        The API is ( it will remove the last level ) ::PathRemoveFileSpec(buffer); if you use .net then you can use Directory.GetParent Method http://msdn.microsoft.com/en-us/library/system.io.directory.getparent(VS.71).aspx[^]

        Vikas Amin

        My First Article on CP" Virtual Serial Port "[^]

        modified on Thursday, July 24, 2008 5:33 PM

        P 1 Reply Last reply
        0
        • V vikas amin

          The API is ( it will remove the last level ) ::PathRemoveFileSpec(buffer); if you use .net then you can use Directory.GetParent Method http://msdn.microsoft.com/en-us/library/system.io.directory.getparent(VS.71).aspx[^]

          Vikas Amin

          My First Article on CP" Virtual Serial Port "[^]

          modified on Thursday, July 24, 2008 5:33 PM

          P Offline
          P Offline
          Parthi_Appu
          wrote on last edited by
          #4

          thanx.. i'm looking for this API..


          Do your Duty and Don't expect the Result

          V 1 Reply Last reply
          0
          • P Parthi_Appu

            thanx.. i'm looking for this API..


            Do your Duty and Don't expect the Result

            V Offline
            V Offline
            vikas amin
            wrote on last edited by
            #5

            welcome , glad it was helpfull

            Vikas Amin

            My First Article on CP" Virtual Serial Port "[^]

            modified on Thursday, July 24, 2008 5:33 PM

            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