Program keep crashing

i was trying to create a program which will list all contents of current folder(yes i am a noob).

but my program is keep crashing.
here is the code...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include<iostream>
#include<stdlib.h>
#include<io.h>

using namespace std;

int main ()
{
    int res;
    long fh ;
    _finddata_t c_file;
    _findfirst("\\*.*",&c_file);

    do{
        cout<<c_file.name<<endl;
    }while((_findnext(fh,&c_file)) == 0);
    return 0;
}



Additional info...
using code blocks 10.5
OS - windows 7 ultimate.
Change line 12 to fh=_findfirst("\\*.*",&c_file);
Thanks NULL that really worked.

i am feeling stupid now lol.

if anyone can give me some easy explanation about this two ( _findfirst , _findnext ) commands that how this commands works that would be really helpful.

because i am new in programming when i looked at msdn's websites i only understood half of it.

this little information will help me a lot.

Last edited on
Topic archived. No new replies allowed.