Basic Products Can Create and Use Non-Standard File Names

ID: Q94783


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for Windows, versions 2.0, 3.0
  • Microsoft Visual Basic programming system for Windows, version 1.0
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0
  • Microsoft Basic Professional Development System for MS-DOS, version 7.1
  • Microsoft QuickBASIC for MS-DOS, version 4.5


SUMMARY

Microsoft Visual Basic and other Basic products can create and use non-standard MS-DOS file names. For example, a file name with an embedded space is a non-standard file name. However, Microsoft doesn't recommend that you use non-standard file names because they can cause problems with other software.


MORE INFORMATION

According to the MS-DOS documentation, file names must:

  • Have no more than eight characters.


  • Contain only the letters A through Z, the numbers 0 through 9, and the following special characters: underscore (_), caret (^), dollar sign ($), tilde (~), exclamation point (!), number sign (#), percent sign (%), ampersand (&), hyphen (-), braces ({}), parentheses (), at sign (@), apostrophe ('), and the accent grave (`). No other special characters are acceptable.


  • Not contain spaces, commas, backslashes, or periods except for the period that separates the name from the extension.


  • Not be the following reserved filenames: CLOCK$, CON, AUX, COMn (where n=1-4), LPTn (where n=1-3), NUL, and PRN.


The Basic OPEN command allows you to open a file name that breaks some of these rules. For example, you can open a file that has a space embedded in its name.

The following example creates a file giving it a name that contains a space. Then it writes data to the file, reopens it, and prints the data on the screen:

  OPEN "A B" FOR OUTPUT AS #1 'There is a space between A and B
  PRINT #1, "HELLO THERE"
  CLOSE #1

  OPEN "A B" FOR INPUT AS #1
  INPUT #1, A$
  PRINT A$
  CLOSE #1 

Additional query words: 2.00 3.00 4.50 7.10

Keywords :
Version :
Platform :
Issue type :


Last Reviewed: September 17, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.