Mail Archives: djgpp/1996/09/30/00:39:08
"Richard L.F. van Paasen" <R DOT L DOT F DOT v DOT Paasen AT stud DOT tue DOT nl> wrote:
>When I use the findfirst() and findnext() functions of libc,
>the first 2 characters of the names in ffblk.ff_name dissapear.
>Is this a bug in libc.a ? With Borland C, this works fine.
This has been a problem for me, too. I tried looking in the faq
(both the djgpp faq and the C++ faq) and couldn't find anything
about it.
The following has worked fine for me, though:
struct _find_t ff;
// this sets up a pointer to an array of file info
struct _find_t *F = (struct _find_t *)malloc(sizeof(ff)*numfiles);
// and the array can be filled with _dos_findfirst and
// _dos_findnext, and a name can be retrieved like this
strcpy(Name, F[a].name-2);
The file data is all in there. For some reason, F[a].name points
to the wrong spot - two bytes after where it should, so simply
subtracting two from it makes it point to the right place.
This looks like it shouldn't work, but it does (at least for
me (for now :) ))
The above code fragments are incomplete. If you want more detail,
just ask.
- Raw text -