KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q58800: Using _dos_findfirst() Function to Retrieve Disk Volume

Article: Q58800
Product(s): See article
Version(s): 5.10
Operating System(s): MS-DOS
Keyword(s): ENDUSER | s_quickc 2.00 s_quickasm 2.01 | mspl13_c
Last Modified: 26-FEB-1990

Question:

I am using the _dos_findfirst() function to find my disk volume. I use
the _A_VOLID attribute to get the disk volume and it works correctly,
except when I get a volume name greater than eight characters. Then, I
get a period embedded in the middle of my string. For example, if my
volume name is "VOLUMENAME", _dos_findfirst returns "VOLUMENA.ME". Why
does the period get embedded in the string?

Response:

Volume labels are a specific type of directory entry specified by
setting bit 3 in the attribute field to 1 or 0x08. They are a special
type of file that can only be in the root directory. The maximum
number of characters a volume label can have is 11 characters (8
characters for the filename followed by a three-character extension).

The C run-time function _dos_findfirst() will return the volume label
in a file format since DOS stores the volume label in the file format.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.