If I try this:
[code]
#include <iostream.h>
#include <windows.h>
void main()
{
WIN32_FIND_DATA data;
FindFirstFile("c:/*.cpp",&data);
cout<<&data;
}
[code]
I get a number that looks like a memory address. How can I extract the filename??
Printable View
If I try this:
[code]
#include <iostream.h>
#include <windows.h>
void main()
{
WIN32_FIND_DATA data;
FindFirstFile("c:/*.cpp",&data);
cout<<&data;
}
[code]
I get a number that looks like a memory address. How can I extract the filename??
No no . You can't print data. Data is a WIN32_FIND_DATA structure now. To get the filename use:
Code:cout<<data.cFileName;
When i tried that b4 it printed a wierd symbol
That is because maybe there are no cpp files in that dir. I tried this code and it works. If there are cpp files it prints the file name of the first one else it prints nothing.
Code:WIN32_FIND_DATA data;
if(FindFirstFile("c:/*.cpp",&data) != INVALID_HANDLE_VALUE)
{
cout<<data.cFileName;
}
Ill try that :)
My syntax is like that but findnext in a loop will only return the first file. Any ideas?