School Computer Project.. searching directories?

Status
Not open for further replies.

karmanya

Journeyman
Hey,
Im in class 12 right now (read : excuse for my inactivity) and I thought that for my board project, I'd end up making an ebook library, mostly because I really need one. One of the things that I need this program to do is to search/scan the computer for all pdf,lit,txt,doc etc etc files (a la, Mediamonkey or iTunes) and write their names and paths to a file. Now I'm pretty sure I can use normal fstream for the writing bit, but I can't find a function to search the computer- findnext and findfirst (from the turbo c++ help files) don't search sub-directories within the ones that i specify for example if i were to say search C:\ it won't look up C:\docs.
Is there anyway around this?
 
Write a Function which takes a directory path ("C:\", or C"\Docs") as argument and then scans the directory and get a list of all the subdirectories. Then recursively call the same function for each of the subdirectories found.

this method will do IMO !!

Example Code:

Void search(string path)
{
..... use ur code to search for subdirectories.....
and then for each of the subdirectories found .....

search(subdirectory);

.......
....
}
-----------------------------------------
Posted again:
-----------------------------------------
Write a Function which takes a directory path ("C:\", or C"\Docs") as argument and then scans the directory and get a list of all the subdirectories. Then recursively call the same function for each of the subdirectories found.

this method will do IMO !!

Example Code:

Void search(string path)
{
..... use ur code to search for subdirectories.....
and then for each of the subdirectories found .....

search(subdirectory);

.......
....
}
 
Last edited:
OP
K

karmanya

Journeyman
@harryneopotter Erm, how exactly do i scan for directories? Since find_next and find_first don't even pick them up.
 

vandit

In the zone
*www.devarticles.com/c/a/Cplusplus/Directories-in-Cplusplus/2/

this might be of some help. And I recollect there is some funtion by a similar name to what you said.. sorry dont have the access to turbo c manuals currently..
 
Status
Not open for further replies.
Top Bottom