From: MARSHALL K. <Kei...@to...> - 2004-05-19 08:23:22
|
Sebastien Kramm wrote: > I'm just trying to read the files in a directory, but the simpliest code > below gives incoherent results. Do I miss something ? Should I use another > function? > > ------------------------------------- > #include <stdio.h> > #include <io.h> > > int main() > { > int handle; > struct _finddata_t s; > > handle = _findfirst( "*.*", &s ); > printf( "handle = %d\n", handle ); > > handle = _findnext( handle, &s ); > printf( "handle = %d\n", handle ); The 'handle' in the above code is really a status return from _findfirst() or _findnext() respectively; it merely indicates whether the call actually found a valid directory entry, or not. When you get a successful return, then you need to examine the data returned in your 's' struct, to retrieve the file info. HTH. Regards, Keith. |