Computing.Net > Forums > Programming > Simple C Help!!!

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Simple C Help!!!

Reply to Message Icon

Name: rabbit_jizz
Date: March 6, 2004 at 16:24:33 Pacific
OS: Windows XP Pro
CPU/Ram: Pentium 4 2.66GHz, 256 DD
Comment:

Can anyone please help me with the following C problem. Am newish to C programming so please be specific. I am using the Dev-C++ compiler.

I want to write a program that prompts the user to input a filename and then searches the whole drive for the file (going through all directories) until it locates it. Its a simple search engine program.

I have looked through many books and have not been able to find a function that does this. Is there a way?

I want the source to be a *.c file and NOT *.cpp!

Thanks,

rabbit



Sponsored Link
Ads by Google

Response Number 1
Name: Ronin1
Date: March 6, 2004 at 20:52:38 Pacific
Reply:

I don't believe there are "directories" in C/C++, so you need compiler specific functions to walk through the drive. The functions findfirst and findnext will do what you need, but they may be Borland specific (dir.h - dos.h). I don't know about Dev-C or win32 api calls.

From Borland's library reference

int done;
struct ffblk ffblk;

done = findfirst("drive\path\file", &ffblk, 0)

while(!done){
/* do something with ffblk.ff_name) */
done = findnext(&ffblk);
}

HTH



0
Reply to Message Icon

Related Posts

See More


Connecting to Oracle 9i u... installing perl !



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Simple C Help!!!

C Program Simple Question (HELP...) www.computing.net/answers/programming/c-program-simple-question-help/10559.html

Binary Search in C. Help Please! www.computing.net/answers/programming/binary-search-in-c-help-please/6847.html

Simple c++ help www.computing.net/answers/programming/simple-c-help/11805.html