Basic Products Can Create and Use Non-Standard File Names (94783)



The information in this article applies to:

  • Microsoft Visual Basic Standard Edition for Windows 2.0
  • Microsoft Visual Basic Standard Edition for Windows 3.0
  • Microsoft Visual Basic Professional Edition for Windows 2.0
  • Microsoft Visual Basic Professional Edition for Windows 3.0
  • Microsoft Visual Basic Standard Edition for Windows 1.0
  • Microsoft Visual Basic for MS-DOS
  • Microsoft Cinemania for Windows 1993 edition
  • Microsoft QuickBASIC 4.5

This article was previously published under Q94783

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
				

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB94783