Mail Archives: djgpp/1997/08/29/21:20:59
This function works. It interposes a `.' between the 8th and 9th characters
of the label (like a filename) but otherwise works fine.
--cut--
#include <dir.h>
#include <string.h>
#include <dos.h>
void get_volume_label(char *buf)
{
struct ffblk f;
findfirst("*.*",&f,FA_LABEL);
/* Fortunately, the usual problem with findfirst, that it finds files with
less than the attributes you wanted, does not occur with DOS version
> 3.0 and a volume label search */
/* This assumes that it will never fail to be found, not necessarily
a safe assumption */
strcpy(buf,f.ff_name);
}
There is also an ioctl call to give the volume label, but that's more
complicated.
--cut--
At 09:21 8/29/1997 GMT, rgh AT fia DOT net wrote:
> Can anyone tell me how to read the volume label of a disk (
>using int86() possibly). I checked the FAQ and info, but they don't
>give much information about how to handle int86 functions which return
>pointers to real address space. The info entry seems to say that
>functions which return such pointers are not supported. I hope there
>is some way to read the label which is supported.
For starters, __dpmi_int is the preferred way to generate real-mode
interrupts. You can fetch real-mode memory using dosmemget().
Nate Eldredge
eldredge AT ap DOT net
- Raw text -