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. Directory path validation problem

Directory path validation problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpcareer
10 Posts 6 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.
  • K Offline
    K Offline
    Karismatic
    wrote on last edited by
    #1

    Hey all, I have to validate the path of a directory i.e the directory path is valid or not. pls help me.

    Regards, Pankaj Sachdeva "There is no future lies in any job" "but" "future lies in the person who holds the job"

    W L K D 4 Replies Last reply
    0
    • K Karismatic

      Hey all, I have to validate the path of a directory i.e the directory path is valid or not. pls help me.

      Regards, Pankaj Sachdeva "There is no future lies in any job" "but" "future lies in the person who holds the job"

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

      PathIsDirectory() Perhaps next time you could look in the documentation[^]

      Waldermort

      E 1 Reply Last reply
      0
      • W Waldermort

        PathIsDirectory() Perhaps next time you could look in the documentation[^]

        Waldermort

        E Offline
        E Offline
        Emilio Garavaglia
        wrote on last edited by
        #3

        Interesting... How you discover that that's the function? By reading all the 10000 pages in strict alphabetical order?

        2 bugs found. > recompile ... 65534 bugs found. :doh:

        W D 2 Replies Last reply
        0
        • E Emilio Garavaglia

          Interesting... How you discover that that's the function? By reading all the 10000 pages in strict alphabetical order?

          2 bugs found. > recompile ... 65534 bugs found. :doh:

          W Offline
          W Offline
          Waldermort
          wrote on last edited by
          #4

          It doesn't take much effort to type into that little box they call "Search" and then click the button called "go"...

          Waldermort

          E 1 Reply Last reply
          0
          • K Karismatic

            Hey all, I have to validate the path of a directory i.e the directory path is valid or not. pls help me.

            Regards, Pankaj Sachdeva "There is no future lies in any job" "but" "future lies in the person who holds the job"

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Hi, here is another option BOOL IsDirectory(TCHAR *szPath) { BOOL bRet = FALSE; DWORD dwResult = GetFileAttributes(szPath); if(dwResult != 0xffffffff && (dwResult & FILE_ATTRIBUTE_DIRECTORY)) { bRet = TRUE; } return bRet; } Best Wishes, -Randor (David Delaune)

            1 Reply Last reply
            0
            • W Waldermort

              It doesn't take much effort to type into that little box they call "Search" and then click the button called "go"...

              Waldermort

              E Offline
              E Offline
              Emilio Garavaglia
              wrote on last edited by
              #6

              in theory yes, but with the new MSDN it becomes a nightmare...

              2 bugs found. > recompile ... 65534 bugs found. :doh:

              W 1 Reply Last reply
              0
              • E Emilio Garavaglia

                in theory yes, but with the new MSDN it becomes a nightmare...

                2 bugs found. > recompile ... 65534 bugs found. :doh:

                W Offline
                W Offline
                Waldermort
                wrote on last edited by
                #7

                Then I suggest you download[^] a copy ;)

                Waldermort

                1 Reply Last reply
                0
                • K Karismatic

                  Hey all, I have to validate the path of a directory i.e the directory path is valid or not. pls help me.

                  Regards, Pankaj Sachdeva "There is no future lies in any job" "but" "future lies in the person who holds the job"

                  K Offline
                  K Offline
                  kamalesh82
                  wrote on last edited by
                  #8

                  DWORD dwFileAttrib = 0; dwFileAttrib = GetFileAttributes(pathof Directory); if(dwFileAttrib == -1 || (dwFileAttrib & FILE_ATTRIBUTE_DIRECTORY) == 0) { AfxMessageBox("Directory path not exist"); }

                  kamalesh

                  1 Reply Last reply
                  0
                  • K Karismatic

                    Hey all, I have to validate the path of a directory i.e the directory path is valid or not. pls help me.

                    Regards, Pankaj Sachdeva "There is no future lies in any job" "but" "future lies in the person who holds the job"

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #9

                    Karismatic wrote:

                    I have to validate the path of a directory...

                    What does "validate" mean? Are you wanting to check if it has invalid characters, or whether it exists?


                    "A good athlete is the result of a good and worthy opponent." - David Crow

                    "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                    1 Reply Last reply
                    0
                    • E Emilio Garavaglia

                      Interesting... How you discover that that's the function? By reading all the 10000 pages in strict alphabetical order?

                      2 bugs found. > recompile ... 65534 bugs found. :doh:

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #10

                      emilio_grv wrote:

                      By reading all the 10000 pages...

                      No, just the ones up to the function that you are interested in. All the pages after that do not need to be read, unless you just wanted to.


                      "A good athlete is the result of a good and worthy opponent." - David Crow

                      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                      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