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 check wheter a specified path is a dir?

How to check wheter a specified path is a dir?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
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.
  • U Offline
    U Offline
    User 12162796
    wrote on last edited by
    #1

    See title:), thanks.. Couldn't find the functions using MSDN or google:(..

    PJ ArendsP RaviBeeR M 3 Replies Last reply
    0
    • U User 12162796

      See title:), thanks.. Couldn't find the functions using MSDN or google:(..

      PJ ArendsP Offline
      PJ ArendsP Offline
      PJ Arends
      wrote on last edited by
      #2

      GetFileAttributes(), check the FILE_ATTRIBUTE_DIRECTORY bit.


      "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!


      Honoured as one of The Most Helpful Members of 2004

      Within you lies the power for good; Use it!

      1 Reply Last reply
      0
      • U User 12162796

        See title:), thanks.. Couldn't find the functions using MSDN or google:(..

        RaviBeeR Offline
        RaviBeeR Offline
        RaviBee
        wrote on last edited by
        #3

        //! Checks whether a directory exists.
        //! @param strDirectory Directory
        //! @return true if the directory exists, false otherwise.
        bool dirExists
        (CString strDirectory)
        {
        // Create full directory specification - return if unable
        TCHAR* fullPath = _tfullpath (NULL, strDirectory, 0);
        if (fullPath == NULL)
        return (false);

        // Check if directory exists by trying to make it the default directory
        TCHAR szCurrDir [_MAX_PATH];
        _tgetcwd (szCurrDir, _MAX_PATH - 1);
        long nStatus = _tchdir (fullPath);
        _tchdir (szCurrDir);

        // Return
        free (fullPath);
        if (nStatus == 0)
        return (true);
        return (false);
        }

        /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

        1 Reply Last reply
        0
        • U User 12162796

          See title:), thanks.. Couldn't find the functions using MSDN or google:(..

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          Or PathIsDirectory() in shlwapi.dll --Mike-- LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD

          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