Count number of files in a folder

This is a discussion on Count number of files in a folder within the C Programming forums, part of the General Programming Boards category; Hi friends, Can anyone tell me how can we count number of files in a folder ? I want to ...

  1. #1
    Registered User
    Join Date
    Jul 2011
    Posts
    24

    Count number of files in a folder

    Hi friends,

    Can anyone tell me how can we count number of files in a folder ?

    I want to do this using C language and without system() function .

    I am using Windows-7 OS and MS Visual C++ compiler.

  2. #2
    Registered User Swarvy's Avatar
    Join Date
    Apr 2008
    Location
    United Kingdom
    Posts
    195
    To the best of knowledge what you want to do can't be done with standard C, you would have to use the windows API to do it (or if portability is an issue then you could research OS portable file handling libraries on the web. I don't know any since I normally just code it in C or C++ but I'm sure there are a few). I could be wrong (and if I am, I hope someone corrects me) but in this case I don't think I am.

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,344
    Or even (shock), the FAQ.
    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. what would I use to count number of words
    By s_jsstevens in forum C Programming
    Replies: 42
    Last Post: 08-11-2009, 07:14 AM
  2. Number of files in a folder
    By gadu in forum C Programming
    Replies: 1
    Last Post: 10-09-2008, 06:16 PM
  3. Count number!
    By tx1988 in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2007, 08:23 PM
  4. how to count the number of sentences.
    By Ray Thompson in forum C Programming
    Replies: 3
    Last Post: 11-10-2002, 09:25 AM
  5. ...how to get the number of files in a folder
    By toby1909 in forum Windows Programming
    Replies: 5
    Last Post: 02-01-2002, 04:43 PM

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