Finding files in a folder

This is a discussion on Finding files in a folder within the C++ Programming forums, part of the General Programming Boards category; How do you supply a wildcard to something and then it returns a list of all files that match it? ...

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    36

    Finding files in a folder

    How do you supply a wildcard to something and then it returns a list of all files that match it? For example, I want to parse all *.txt files in a directory, how would I go about doing that? In other languages it's been FindFirst and FindNext

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,168
    The method of doing this is operating system dependent: the C and C++ standards do not define this sort of functionality.

    If you're under windows, the functions in the win32 SDK are FindFirstFile() and FindNextFile(), which are declared in the (windows specific) header <winbase.h>. On other operating systems, the function names are different.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,420
    <fake excitement>
    I know this, I know this!!!!!
    <bored again>
    http://faq.cprogramming.com/cgi-bin/...&id=1044780608
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Making a folder and moving files into it?
    By HLA91 in forum C Programming
    Replies: 1
    Last Post: 01-27-2008, 11:38 AM
  2. Finding files in a directory
    By smarta_982002 in forum C Programming
    Replies: 1
    Last Post: 01-25-2008, 09:10 AM
  3. How To Make The Program Installed In Program Files Folder?
    By javacvb in forum Windows Programming
    Replies: 4
    Last Post: 11-05-2003, 04:33 PM
  4. I Need To Know Some Things That I Can Put Into A Batch File
    By TheRealNapster in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 10-20-2003, 08:12 PM
  5. reinserting htm files into chm help files
    By verb in forum Windows Programming
    Replies: 0
    Last Post: 02-15-2002, 08:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21