"File Not Found" OPENing Filename with Leading Spaces (71792)






This article was previously published under Q71792

SYMPTOMS

When you attempt an OPEN statement that specifies a filename with a leading space, a "File Not Found" error incorrectly displays (even if the file is opened FOR OUTPUT). The correct error message should be "Bad File Name."

STATUS

Microsoft has confirmed this to be a bug in Microsoft QuickBasic versions 3.00, 4.00, and 4.50; with Microsoft Basic Compiler versions 6.00 and 6.00b (buglist6.00 and buglist6.00b); and with Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10 (buglist7.00 and buglist7.10). We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

The workaround is to strip leading blanks from the filename used in the OPEN statement.

MORE INFORMATION

When the following program is run (either in the QB.EXE or QBX.EXE environment or when compiled to an executable .EXE program), it generates a "File Not Found" error:

Code Sample

OPEN "  test.dat" FOR OUTPUT AS #1

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB71792