• Advertisement
Sign in to follow this  

Iterating through all the files in a folder

This topic is 4577 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement