-
Okay I've checked 3 api sites and a book and they all say this works. Unfortunately I can't make a long value equal FindFirstFile or FindNextFile. Here's my code.
Can someone make this work correctly? Btw it only grabs the first 2 files in this code, i'll add my loop later
[code]
#include <iostream.h>
#include <windows.h>
void main()
{
WIN32_FIND_DATA data;
char search[] = "C:/windows/system/*.dll";
long hsearch;
hsearch = FindFirstFile("C:/windows/system/*.dll",&data);
cout<<data.cFileName<<endl;
FindNextFile(hsearch,&data);
cout<<path<<data.cFileName<<endl;
}
-
The FindFirstFile function returns a HANDLE not long. Use This:
Code:
WIN32_FIND_DATA data;
char search[] = "C:/windows/system/*.dll";
HANDLE hsearch;
hsearch = FindFirstFile ( "C:/windows/system/*.dll",&data);
cout<<data.cFileName<<endl;
FindNextFile(hsearch,&data);
cout<<data.cFileName<<endl;
-
*Sigh*
Thank you once again Vlatko. Is there a good resource for using the API in C++? I can use them fine in vb. Just its the C++ conversions that get me :) :)
-
Download the platform SDK from microsoft.
that has documentation on almost all of the API's
-
Could you?
Could you give me the link? I have HORRIBLE luck navigating the msdn site for anything
-
I meant..
I meant what is the SDK you mean? I can't find one for C++ or API on msdn