Iterating through all the files in a folder

Started by
5 comments, last by C J W 18 years, 6 months ago
Are there functions provided by the WinAPI which allow me to iterate through all the files in a given folder. All I need is the filename of each file.
ToDoList.GrowthRate = WorkRate*2, it's more efficient to not work.
Advertisement
FindFirstFile(), FindNextFile(), and FindClose().
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke
Thanks very much!
ToDoList.GrowthRate = WorkRate*2, it's more efficient to not work.
A totaly unrelated question, but what is a reasonable size for a function, I have a function which is around 700 lines and is looking rather large. However in this function there is very little code repeated more than once, should I split this function up, or keep it the way it is?

EDIT: The code is also very unlikely to be repeated anywhere else in the program.
ToDoList.GrowthRate = WorkRate*2, it's more efficient to not work.
I would split that function into smaller functions for better readability.
700 lines of code? That's a bit... big. Try to divide it up for easier readability and maintenance and error-checking.

If there's display stuff and loading files and stuff in one, divide it up:
DisplayListofFiles()
LoadInList()
LoadInFile()
DoSomeStuff()
etc...

I normally have about 20-100 lines per function, unless it's one of the important functions (Game_Play(), MapEditor(), etc)

Edit: Beaten to it by one second!
Heh thanks, the actual function in question is not related to the file lists inside folders, but thanks anyway. I just like to have an idea what kind of size a regular function is.
ToDoList.GrowthRate = WorkRate*2, it's more efficient to not work.

This topic is closed to new replies.

Advertisement