Iterating through all the files in a folder
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.
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.
EDIT: The code is also very unlikely to be repeated anywhere else in the program.
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!
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!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement