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. Non-MFC Equivalent to CFileFind?

Non-MFC Equivalent to CFileFind?

Scheduled Pinned Locked Moved C / C++ / MFC
c++beta-testingjsonquestion
4 Posts 4 Posters 2 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.
  • D Offline
    D Offline
    Dan Watt
    wrote on last edited by
    #1

    I need the functionality of CFileFind for a project, but I can't be dependent on MFC for this project. Is there an API equivalent, or better a portable library for doing this? I know Boost has a class dir_it that will do it, but it looks like its still in beta.

    S RaviBeeR Michael HaephratiM 3 Replies Last reply
    0
    • D Dan Watt

      I need the functionality of CFileFind for a project, but I can't be dependent on MFC for this project. Is there an API equivalent, or better a portable library for doing this? I know Boost has a class dir_it that will do it, but it looks like its still in beta.

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #2

      CFileFind is based on a Win32 API. To do it w/out MFC, use something like this:

      WIN32_FIND_DATA FindFileData;
      HANDLE hFind = FindFirstFile(strCurrentPath + m_szREPORT_FILTER, &FindFileData);
      if (hFind != INVALID_HANDLE_VALUE)
      {
      do
      {
      // do stuff with FindFileData.cFileName
      } while ( FindNextFile( hFind, &FindFileData) );
      FindClose(hFind);
      }

      --------

      Life is fraught with opportunities to keep your mouth shut.

      --Shog9 --

      1 Reply Last reply
      0
      • D Dan Watt

        I need the functionality of CFileFind for a project, but I can't be dependent on MFC for this project. Is there an API equivalent, or better a portable library for doing this? I know Boost has a class dir_it that will do it, but it looks like its still in beta.

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

        You could also use _findfirst(), _findnext() and _findclose(). /ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com

        1 Reply Last reply
        0
        • D Dan Watt

          I need the functionality of CFileFind for a project, but I can't be dependent on MFC for this project. Is there an API equivalent, or better a portable library for doing this? I know Boost has a class dir_it that will do it, but it looks like its still in beta.

          Michael HaephratiM Offline
          Michael HaephratiM Offline
          Michael Haephrati
          wrote on last edited by
          #4

          CFileFind is supported by ATL so a pure Win32 API project should support CFileFind.

          - Michael Haephrati מיכאל האפרתי

          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