I've tried with the following compilers (on winxp), both
with similar (slightly different .. STRANGE runtime
behaviour) .. both compilers compiled the below code.
* gcc (GCC) 3.2 (mingw special 20020817-1)
* gcc (GCC) 3.2.3 (mingw special 20030504-1)
BUG behaviour
w/ 3.2:
* when 2,3,4...,13,..? variables (any var, i think) is
declared before _findfirst, _findfirst crashes.
* when 1 variable is declared (before _findfirst), it
seems to work
w/ 3.2.3
* always seems to crash, even when no variables are
declared.
SAMPLE CODE: .. this code compiles, but crashes on the
_findfirst function call for me, every time, using gcc 3.2.3
the code "should" return the first found file in the c:\
directory.
__BUG_TEST_CODE - for GCC 3.2.3__
#include <io.h>
main () {
// int a, b; // uncomment this for gcc 3.2 test struct \_finddata\_t \* asdf; \_findfirst \(&quot;c:/\*&quot;, asdf\); printf \(&quot;%s&quot;,asdf-&gt;name\);
}
Logged In: YES
user_id=800187
i tested a few more cases .. again, compiling using gcc (GCC)
3.2.3 (mingw special 20030504-1),
apparantly, declaring 0-8 variables before _finddata crashes
each time, but declaring 9 variables:
works =) .. so, as a *temporary* solution, one must declare 9
variables (any type) before the _findfirst function call =(
Logged In: YES
user_id=11494
Your code is buggy. You didn't allocate the _finddata_t
buffer.
#include <io.h>
int main () {
struct _finddata_t asdf;
_findfirst ("c:/*", &asdf);
printf ("%s",asdf.name);
return 0;
}