CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    1

    Search for files using their formats

    Hi and greeting to all

    I have a small problem and i hope someone can help me through ur fruitful forums here, and please excuse my weak language.

    I need to design a program that has some functionality intends to search for files using their formats. I have been advised to use the C++ WinAPI to be able using some function from Windows.

    I do need any help to make the program search for all files that has the .INI format, as an example. After gathering these files i need them somehow to process some operations on them that i will handle later.

    I appreciate ur cooperation.

    My kind regards..

  2. #2
    Join Date
    Nov 2006
    Posts
    1,611

    Re: Search for files using their formats

    The MSDN samples show how to use FindFirstFile and FindNextFile (and they have an "ex" version, too).

    These allow you to supply wildcards to the search term, as in "*.ini".

    The use of these is recursive, and I believe at least one sample shows that. In other words, when you get an entry and discover it is a directory, not a file, you'll perform a recursive search in that directory, continuing recursively in a fashion that searches all directories and subdirectories on a drive.

    If you need to search all drives, you'll also need to search "getdrives" - it's a little uncomfortable at first, but it will reveal all of the drives on the system. You'll need to search each drive if "all drives" is your target interest.
    If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).

  3. #3
    Join Date
    May 2005
    Posts
    4,954

    Re: Search for files using their formats

    This FAQ might help.

    Cheers
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured