newbie: _findfirst bug or is it me?

Craveiro, Marco
Tue Jul 20 08:15:00 GMT 1999

hi everyone,

i'm a newbie that's been using egcs for windows, version 2.91.57 for 2
months. I have a dell PII 233 and everything has been fine until today. but
the following code does not work and i just cannot find anything wrong with

#include <dir.h>
#include <iostream.h>

void main()
   int iHandle;
   int iResult;
   struct _finddata_t * find;

   iResult = _chdir ("c:\\");  
   iHandle = _findfirst ("*.txt", find); 

   if ((iHandle == -1)) 
      cout << "no files found.";
      cout << find->name << "\n";
      while (!(iResult == -1))
         iResult = _findnext (iHandle, find);
         cout << find->name << "\n";
      _findclose (iHandle);

it produces an ilegal operation if i run it. (crashes in the _findfirst). do
i need to do something different to use <dir.h>?? can anybody tell me what
am i doing wrong?



"Somebody help me, tell me where to go from here
Cause even Thugs cry, but do the Lord care?"

Want to unsubscribe from this list?
Send a message to

More information about the Cygwin mailing list