i was told you can read the contents of a directory much like you would the contents of a file....Is this true, and if so, how do i do it?
i was told you can read the contents of a directory much like you would the contents of a file....Is this true, and if so, how do i do it?
I doubt thats in the ANSI C, so what platform are you using ?
Win/Linux ??
I'm using windows 98 second edition and ms visual 6.0.
i forgot to add i'm using c++.
thanks, msdn was a lot of help and i now understand how to search through a directory.
I now need a good algorithm for searching for a file on a computer starting at the root directory and searching through all folders.
Should i search the root folder first, then start searching the subfolders or should i go to the deepest subfolder and start searching there?
any pseudo code would be a great help.
Thanks.
I'd try to take into account what your searching for,
ex.
if you looking for a file that has the letters 'win' in it,
Try to begin your search in the windows folder.
so, a substring search on all the folders in the root to begin...
I'm not sure why you would need to do this.Originally posted by Unregistered
thanks, msdn was a lot of help and i now understand how to search through a directory.
I now need a good algorithm for searching for a file on a computer starting at the root directory and searching through all folders.
Should i search the root folder first, then start searching the subfolders or should i go to the deepest subfolder and start searching there?
any pseudo code would be a great help.
Thanks.
well, i can search for the file in the current working directory just fine or if i specify a directory path. But say i don't know what directory the file is in? What's the best approach to traversing the directories for the file?
Could you please post a link of the information that you found on msdn? I can't seem to find any usefull information there.Originally posted by Unregistered
thanks, msdn was a lot of help and i now understand how to search through a directory.
I now need a good algorithm for searching for a file on a computer starting at the root directory and searching through all folders.
Should i search the root folder first, then start searching the subfolders or should i go to the deepest subfolder and start searching there?
any pseudo code would be a great help.
Thanks.
http://msdn.microsoft.com/library/de...y_category.asp
check out the system calls...
also here is an example of a program to find .c files....
http://msdn.microsoft.com/library/de..._Functions.asp