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. Check if is folder or file function?

Check if is folder or file function?

Scheduled Pinned Locked Moved C / C++ / MFC
question
9 Posts 5 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hello Comunity, is there any function to determine is it a folder or file, e.g. C:\folder\file.txt <-- path to file C:\folder\files\ <-- path to folder C:\folder\files <-- path to folder thanks in advance regards break

    P D 2 Replies Last reply
    0
    • L Lost User

      Hello Comunity, is there any function to determine is it a folder or file, e.g. C:\folder\file.txt <-- path to file C:\folder\files\ <-- path to folder C:\folder\files <-- path to folder thanks in advance regards break

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

      Use PathIsDirectory.

      Prasad Notifier using ATL | Operator new[],delete[][^]

      L 1 Reply Last reply
      0
      • P prasad_som

        Use PathIsDirectory.

        Prasad Notifier using ATL | Operator new[],delete[][^]

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

        Hello Prasad, thanks for answer! :) regards break; -- modified at 7:30 Thursday 22nd March, 2007

        R 1 Reply Last reply
        0
        • L Lost User

          Hello Prasad, thanks for answer! :) regards break; -- modified at 7:30 Thursday 22nd March, 2007

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #4

          break; wrote:

          thanks for quick answer!

          So why do you delay in polling a quick vote for him?


          Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

          D 1 Reply Last reply
          0
          • R Rajesh R Subramanian

            break; wrote:

            thanks for quick answer!

            So why do you delay in polling a quick vote for him?


            Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

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

            When all of the dust settles, does it even matter when, or even if, he votes? :rolleyes:


            "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

            "Judge not by the eye but by the heart." - Native American Proverb

            R 1 Reply Last reply
            0
            • D David Crow

              When all of the dust settles, does it even matter when, or even if, he votes? :rolleyes:


              "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

              "Judge not by the eye but by the heart." - Native American Proverb

              R Offline
              R Offline
              Rajesh R Subramanian
              wrote on last edited by
              #6

              :-D Not really that it matters, but IMO they should be thankful when they get help, but they don't do..


              Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

              D 1 Reply Last reply
              0
              • R Rajesh R Subramanian

                :-D Not really that it matters, but IMO they should be thankful when they get help, but they don't do..


                Nobody can give you wiser advice than yourself. - Cicero ப்ரம்மா

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

                Last time I checked, "thanks for answer" was being thankful. That in itself is all that's necessary to express thanks. Voting is nothing but extra.


                "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                "Judge not by the eye but by the heart." - Native American Proverb

                1 Reply Last reply
                0
                • L Lost User

                  Hello Comunity, is there any function to determine is it a folder or file, e.g. C:\folder\file.txt <-- path to file C:\folder\files\ <-- path to folder C:\folder\files <-- path to folder thanks in advance regards break

                  D Offline
                  D Offline
                  DLChambers
                  wrote on last edited by
                  #8

                  Here's a Win95 :) compatible way of doing it:

                  // Get full attributes
                  DWORD dwAttrib = GetFileAttributes(psPath);
                  // Convert non-existance code to a value that will fail the bit-test
                  if(0xFFFFFFFF == dwAttrib)
                  dwAttrib = 0;
                  // Does it exist, and is it a dir?
                  if(0 != (dwAttrib&FILE_ATTRIBUTE_DIRECTORY))
                  // It's a dir!

                  L 1 Reply Last reply
                  0
                  • D DLChambers

                    Here's a Win95 :) compatible way of doing it:

                    // Get full attributes
                    DWORD dwAttrib = GetFileAttributes(psPath);
                    // Convert non-existance code to a value that will fail the bit-test
                    if(0xFFFFFFFF == dwAttrib)
                    dwAttrib = 0;
                    // Does it exist, and is it a dir?
                    if(0 != (dwAttrib&FILE_ATTRIBUTE_DIRECTORY))
                    // It's a dir!

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

                    Hello, thank you for help :) regards termal

                    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