Structure define not recognized by compiler

Started by rp108, August 18, 2014, 03:31:26 AM

Previous topic - Next topic

rp108

I am using the microsoft _findfirst, _findnext, etc functions to scan a directory for files.

These functions require the  io.h  file to be included.

In the io.h file, there is a structure defined that holds the data that is found:
struct _finddata_t {
    unsigned int attrib;
    time_t time_create;
    time_t time_access;
    time_t time_write;
    unsigned long size;
    char name[260];
};

I have written a scanning function to call  _findfirst and  _findnext.
My scanning function declares a variable finfo:

_finddata_t finfo;

I have included  io.h  before the scanning function occurs in the  main.c file, but the Pelles C compiler complains (about the above code line):

error #2048: Undeclared identifier '_finddata_t'.

As an experiment, I defined the structure (exactly as above) within my scanning function itself, but I still get the very same error.

I actually copied code I had written years ago in VisStudio, and it worked there.....

Any help is much appreciated.

Thanks,
Robert




JohnF


frankie

As John said you must use:
struct _finddata_t finfo;
the reason is that there is no 'typedef' for '_finddata_t'.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

rp108