Solved

Searching the HD in C

Posted on 1997-12-07
3
214 Views
Last Modified: 2012-05-04
Im trying to write a program that has an automatic config.
I need to get the program to search the HD for a file.. say called rene.bla  and then return its path to a string maybe, so i can use it.  Any ideas?
Thanks!!!!!
0
Comment
Question by:lint17
3 Comments
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1256537
What you'll need to do is to search each drive. For every drive on the system, start searching at the root. If that file doesn't exist, recursively traverse each subdirectory and look for that file (using findfirst()/findnext()).


0
 
LVL 7

Expert Comment

by:galkin
ID: 1256538
You must establish search engine.

// assuming that lpszPathName is path name of the folder(drive) // in your case you must itterate through all hard disk drives // and perform the following code


HANDLE hFile;
WIN32_FIND_DATA FindFileData;

if((hFile = ::FindFirstFile(lpszPathName, &FindFileData))
                              == INVALID_HANDLE_VALUE)
// file not found
else
// file found, you must close search engine
::FindClose(hFile);


0
 
LVL 1

Accepted Solution

by:
messiah earned 50 total points
ID: 1256539
Doesnt work.. but you did try pretty good so I still give the points.

I have Borland Turbo C++ v2.0 for DOS.
there were compiler errors all over the place.
thanks

0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Trouble linking program with -lcrypt 3 141
How to creat good software interface ? 1 60
Digital Output does not have continuity to ground? 3 83
Computer slow / BSOD 10 39
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now