C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-11-2008, 11:21 AM   #1
Registered User
 
Join Date: Oct 2008
Posts: 10
How to extract a list of files in a specific directory?

Hello,

I've started work on a small training project, which basicaly goes like this: You choose a directory and the program populates a list of files IN that directory along with the "Last modified" date. It, basicaly, works like the dir command in the command prompt.

While I've got the little details sorted out I've got no clue or an intelligent guess of where to start with the files list. I don't know how to extract the first file name, how to get a number of files in that directory, how to cycle the file names, if that's possible - in what order will I get the names. And so on...

I just need a heap of characters representing the file names (pats would be great too) stored in an accesible format. An explanation would be nice, a point in the right direction (internet tutorial, Borland C++ 5 Builder Help index etc.) would be equaly nice and appreaciated.
Perspektyva is offline   Reply With Quote
Old 11-11-2008, 11:26 AM   #2
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
There is a FAQ entry for "how do I list files in a directory" or some closely resembling subject.

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 11-11-2008, 11:54 AM   #3
Registered User
 
Join Date: Oct 2008
Posts: 10
Can't... seem to find it...
Perspektyva is offline   Reply With Quote
Old 11-11-2008, 12:33 PM   #4
and the hat of vanishing
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,214
http://faq.cprogramming.com/
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Up to 8Mb PlusNet broadband from only £5.99 a month!
Salem is offline   Reply With Quote
Old 11-11-2008, 02:02 PM   #5
Registered User
 
Join Date: Oct 2008
Posts: 10
Oh this faq, I was looking to the forum one, thanks.
Perspektyva is offline   Reply With Quote
Reply

Tags
dir, directory, file, file list, list

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
c program to print list of files in a directory leo_1024 Linux Programming 3 01-24-2009 05:54 AM
Unknown memory leak with linked lists... RaDeuX C Programming 6 12-07-2008 04:09 AM
List files in a directory (without folders) 3saul Linux Programming 4 04-20-2006 01:08 AM
list size of files in directory mayhem C Programming 3 02-27-2005 11:52 PM
List class SilasP C++ Programming 0 02-10-2002 05:20 PM


All times are GMT -6. The time now is 05:44 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

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