Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to know the availability in a specified directory ???

Status
Not open for further replies.

isaisa

Programmer
May 14, 2002
97
IN
Hi...
I want to find if there are any files present in the specified directory using SDK [win32 API's only]. If the files are available, i want to know the names of the files in that directory.

For example: The specified directory is d:\sanjay
I want to know which files are present in this directory using win32 APIs.

Please suggest.
Thanks in advance.

Sanjay
 
why not capture dir *.* output ? ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
Hi NEVERSLEEP,
Thanks for your reply.
I want to know how it can be acheived programatically.
I had a thought around this problem. As per as my knowledge goes, system keeps an information in the parent directory about the files it contains. This is a useful information the system refers to while accessing the file under some directory. Is there any means to capture this information using win32 APIs.
I am not sure about the above approach. Please suggest if it is not proper. I am searching for an API which will give me the mentioned information from directory header.

The whole idea is to capture the files under the directory and store their names in to an array and then display these names in to text box.

Please suggest.
Thanks,
sanjay

 
i can't seem to be able to make it
can u use another language ?
perl =
Code:
@stuff = `dir *.*`;
chomp @stuff;
---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
If you have access to the platform SDK documentation, look at FindFirstFile, FindNextFile and FindClose API calls. Also Visual C has in its runtime _findfirst, _findnext and _findclose functions which you can use.

Marcel
 
Hi...
I got it...i tried with FindFirstFile, FindNextFile and it worked under VC++.

The new problem is now i am using the same on windowsCE for pocketPC [Symbol 8100]. I am facing some problems as the FindFirstFile API is failing. I am developing the dialog based application on the same. I am not able to trace the error number proeprly with GetLastError function.
Please suggest...

Thanks in advance.
Sanjay
 
Sorry, I have no experience on WindowsCE. The only thing I can give you is a quote out of the MSDN library on FindFirstFile:

Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

<End quote>

Marcel
 
Hi Marcel...
Thanks for your help.
I tried it on the emulator of Symbol 8100 and it worked properly. Only thing is that i faced some problems in displaying the messages. It is working properly now.

Thanks again.
Sanjay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top