BSAVE Filename Fails to Default to .BAS with Far Strings (71110)






This article was previously published under Q71110

SYMPTOMS

By historical convention dating back to the BasicA and GW-Basic Interpreters, the BSAVE statement creates files with the default name-extension ".BAS" if you specify no name extension (and no period) in the filename.

In Microsoft Basic PDS version 7.00 or 7.10, the filename extension written by BSAVE fails to default to .BAS if you are using far strings (either in the QBX.EXE environment, which always uses far strings, or from a program compiled with BC /Fs).

STATUS

Microsoft has confirmed this to be a bug in Microsoft Basic Professional Development System versions 7.00 and 7.10 for MS-DOS and MS OS/2. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

NOTE: Although it is a convention, the default .BAS extension for files created by BSAVE can cause problems. If you specify a BSAVE filename that is the same as the base name of one of your Basic source files, you may unintentionally overwrite your source file. For example, if you have a Basic source file named "X.BAS", and you run the program below in the same directory, then the BSAVE file "X" with the default extension .BAS will overwrite your source file "X.BAS". Therefore, Microsoft strongly suggests that you specify an extension (but not .BAS) for all BSAVE files. If you want a BSAVE file without a name extension, you can use a period (.) alone as the file extension (such as BSAVE X.), which prevents Basic from appending the default .BAS extension.

Code Example

DIM x%(100)
DEF SEG = VARSEG(x%(0))
BSAVE "X", VARPTR(x%(0)), 200
END
				
When using Microsoft Basic PDS 7.00 or 7.10 with far strings (using QBX.EXE, or BC /Fs), this program will save the array x%() in a file named X, violating the historical Basic convention. If you compile to use near strings (BC with no /Fs), or run or compile with earlier versions of Microsoft Basic, the filename will be X.BAS.

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB71110