Mail Archives: djgpp/1999/04/02/02:05:42
On Fri, 19 Mar 1999, Frank Frederiksen wrote:
> > /* Scan from c: and upwards */
> > for(drive=2;drive<setdisk(getdisk());drive++) {
> > if(_get_dev_info(drive)==-1)
> > printf("Error on drive %c (%d)\n", drive+'A', errno);
> > else
> > printf("Drive %c is OK\n", drive+'A');
> > }
Sorry for a late reply.
I'm afraid this is simply a bug in the DJGPP docs: the libc reference
says that the argument to _get_dev_info is a handle or a drive number.
The latter part is incorrect: the function accepts *only* file handles.
So, to get info about a disk file, you need to open a file on that disk,
and then pass the handle to _get_dev_info.
The strange behavior you reported is due to the fact that the function
was interpreting the argument as a file handle, and thus any open handle,
like those in the 0-4 range, would succeed, while the rest would fail.
I'm sorry for the confusion; I just checked in a change for the next
release.
- Raw text -