Solved

For directory search ?

Posted on 2000-03-16
1
177 Views
Last Modified: 2010-04-02
I would find out if geret.exe exists under c:\game\ by programming.
How to?
Thx
0
Comment
Question by:huangyun
1 Comment
 
LVL 5

Accepted Solution

by:
Wyn earned 183 total points
ID: 2626844
Hellow ,
Here is a function I once wrote.You can use it to test if a file exist,plz notice you'd pass the name into it:
Here name is "geret.exe"
BOOL IsFileExist(char* name)
{
char Des[MAX_PATH]="c:\\game\\";
BOOL  Done;                     // Done searching for files?
HANDLE  FndHnd = NULL;   // Handle to find data.
WIN32_FIND_DATA FindDat;  // Info on file found.
strcat(Des,(const char*)name);
FndHnd =FindFirstFile(Des, &FindDat);
   if(!FndHnd)  //NO THIS FILE
   return FALSE;
   else{
   FindClose(FndHnd); // Close the find handle
   return TRUE;}
}

I think above is exact what you need.
Hope helpful
Regards
W.Yinan
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

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

24 Experts available now in Live!

Get 1:1 Help Now