Anyone know how to read a disks volume label from C 
Author Message
 Anyone know how to read a disks volume label from C

Curious, also to read a disks size if it has greater than 300MB.

Thanks for any info.

Frank Castaneda



Thu, 06 Jan 2000 03:00:00 GMT  
 Anyone know how to read a disks volume label from C



Quote:
>Curious, also to read a disks size if it has greater than 300MB.

>Thanks for any info.

>Frank Castaneda


By 'volume label' do you mean something like 2922-16E4 (serial) or
SYMBIONT (volume)?

Both are stored in the boot sector, but there are certain calls to read
disk parameter info, unfortunately I've forgotten them :(

You could always try the biosdisk() functions.
--
Revised anti-spam in use : remove X to reply -
'Xnetbook' becomes 'netbook'

Anti-spam thermonuclear warheads cheap at only $300!



Fri, 07 Jan 2000 03:00:00 GMT  
 Anyone know how to read a disks volume label from C

Quote:

>How to read a disks volume label from C?

This is for Turbo C but other products should have a similar library.
The disks label is stored in the root directory.

#include <dir.h>
#include <dos.h>

struct ffblk dirblock;

findfirst("C:\",&dirblock,FA_LABEL);

printf("%s",dirblock.ff_name);

---------
getdfree() will give you info about the disk size.  It is in dos.h



Sat, 08 Jan 2000 03:00:00 GMT  
 Anyone know how to read a disks volume label from C

Quote:


> >How to read a disks volume label from C?

> This is for Turbo C but other products should have a similar library.
> The disks label is stored in the root directory.

Hi Larry,

I don't fully agree with this. It should be: "other products *might*
have ...". Acessing directories or specific properties thereof is
not supported by many compilers. And compilers and/or OS who do, do
it in very different ways.

The general way is to look for supporting functions in the compiler
documentation. BTW, this is also covered by the FAQ, look for:
  19.20:  How can I read a directory in a C program?

You can get the FAQ at http://www.eskimo.com/~scs/C-faq/top.html or
at ftp://rtfm.mit.edu/pub/usenet/comp.lang.c/C-FAQ-list and it gets
posted to this newsgroup and to news.answers regularly (at the
beginning of each month).

Stephan
(initiator of the campaign against grumpiness in c.l.c)

Quote:

> #include <dir.h>
> #include <dos.h>

> struct ffblk dirblock;

> findfirst("C:\",&dirblock,FA_LABEL);

> printf("%s",dirblock.ff_name);

> ---------
> getdfree() will give you info about the disk size.  It is in dos.h



Sat, 08 Jan 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Disk Volume Labels using BC 4.0

2. How to get volume label from disk

3. Disk volume label

4. writing/reading volume label from an application

5. writing/reading volume label from an application

6. Anyone know how to Read/Write to a Serial Port

7. volume label

8. Getting the volume label of a drive

9. Volume labels again

10. Volume label problem solved!

11. Volume labels from MS-DOS function calls

12. Volume labels from MS-DOS function calls

 

 
Powered by phpBB® Forum Software