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. Does this bit of code work?

Does this bit of code work?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 Posts 2 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.
  • D Offline
    D Offline
    DarrollWalsh
    wrote on last edited by
    #1

    CFileFind finder; static const TCHAR szFileToFind[] = _T("*.dll"); Cstring Plugins[100]; int tag = 0; bool bResult = finder.FindFile(szFileToFind); while (bResult) { // Grab actual results finder.FindNextFile(); Plugins[tag] == (LPCTSTR) finder.GetFileName(); tag++; // Get next file bResult = finder.FindFile(szFileToFind); } finder.Close(); I am away from a compiler ATM. Thanks for your help. Darroll Not one person lives in the present. Only the past. I can prove it.

    M 1 Reply Last reply
    0
    • D DarrollWalsh

      CFileFind finder; static const TCHAR szFileToFind[] = _T("*.dll"); Cstring Plugins[100]; int tag = 0; bool bResult = finder.FindFile(szFileToFind); while (bResult) { // Grab actual results finder.FindNextFile(); Plugins[tag] == (LPCTSTR) finder.GetFileName(); tag++; // Get next file bResult = finder.FindFile(szFileToFind); } finder.Close(); I am away from a compiler ATM. Thanks for your help. Darroll Not one person lives in the present. Only the past. I can prove it.

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

      The CFileFind interface is a bit wonky.

      BOOL bWorking = finder.FindFile ( szFileToFind );

      while ( bWorking )
      {
      bWorking = finder.FindNextFile();
      Plugins[tag] = finder.GetFileName();
      }

      The return value from FindNextFile() indicates whether you just got the last file in the search, which is contrary to how most classes do it (where the return indicates whether you've gone through all the files). When it returns FALSE, you still have one file left to process. --Mike-- Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm

      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