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. CString question

CString question

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 3 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
    locoone
    wrote on last edited by
    #1

    im using CFileFind to search for certen file types (EG. .log .tmp .bak" the way i have it is after it finds a file it run another loop to check all the file types im looking for is there a better and fast way to check if the file found matches what im looing for? is there a way to put all the file types in a string and check it once for each file found instead of the loop? and im checking each file found against 2 other list a file exclue and path exclude list. :confused: as it is it takes about 6 mins to scan all of my harddrives.

    V D 2 Replies Last reply
    0
    • L locoone

      im using CFileFind to search for certen file types (EG. .log .tmp .bak" the way i have it is after it finds a file it run another loop to check all the file types im looking for is there a better and fast way to check if the file found matches what im looing for? is there a way to put all the file types in a string and check it once for each file found instead of the loop? and im checking each file found against 2 other list a file exclue and path exclude list. :confused: as it is it takes about 6 mins to scan all of my harddrives.

      V Offline
      V Offline
      Vaclav_
      wrote on last edited by
      #2

      Could you use "FindOneOf" in CString? For example I am looking for a numeric value in my string using this: CString subWeight = "0123456789"; int found = strText.FindOneOf(subWeight); Vaclav

      1 Reply Last reply
      0
      • L locoone

        im using CFileFind to search for certen file types (EG. .log .tmp .bak" the way i have it is after it finds a file it run another loop to check all the file types im looking for is there a better and fast way to check if the file found matches what im looing for? is there a way to put all the file types in a string and check it once for each file found instead of the loop? and im checking each file found against 2 other list a file exclue and path exclude list. :confused: as it is it takes about 6 mins to scan all of my harddrives.

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

        For each file found, call PathFindExtension() to get its extension. Then just compare that extension with those in your list (e.g., .log, .tmp, .bak).


        "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

        L 1 Reply Last reply
        0
        • D David Crow

          For each file found, call PathFindExtension() to get its extension. Then just compare that extension with those in your list (e.g., .log, .tmp, .bak).


          "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

          L Offline
          L Offline
          locoone
          wrote on last edited by
          #4

          its not just extensions im searching for for some ill find the whole thing like "readme.txt" for some i need to find just the first part like "readme" for the rest it will be the extension i have it where it breaks the word down from "readme.txt" to "readme" ".txt" and i check all 3 but it is very slow running the loop for every file found right now there is about 30 different things im searching for so for each file found the loop runs 30 times and there is 3 list so for each file and folder found the loop really runs about 40 times thats why i need a way to check all 30 at once.

          D 1 Reply Last reply
          0
          • L locoone

            its not just extensions im searching for for some ill find the whole thing like "readme.txt" for some i need to find just the first part like "readme" for the rest it will be the extension i have it where it breaks the word down from "readme.txt" to "readme" ".txt" and i check all 3 but it is very slow running the loop for every file found right now there is about 30 different things im searching for so for each file found the loop runs 30 times and there is 3 list so for each file and folder found the loop really runs about 40 times thats why i need a way to check all 30 at once.

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

            locoone wrote:

            ...i need a way to check all 30 at once.

            You can't get around this requirement. In other words, if you are looking for .log, .tmp, and .bak files, you will need to do three checks for each file found. Does this help?


            "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