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!!!
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?
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); }
Summary: Please, can anyboby help me with the problem in this simple C program ? After running, I can answer just the first question. The second question comes with "R=1" in front of the word "Aswer:". PLEASE ...
Summary: Hi, I am trying to do a Binary Search for a 15 number array in C. I included the whole code but the only part I am seeking help with is the Binary Search part. When i look up a number in my, I can't...
Summary: Ummm can anyone help me with C++ tell me how i would check if a file (of name from cin by user) exists? [2] How will i check for null string value? [3] how to delete existing file entred by user. ...