Microsoft KB Archive/88258

= Project File Trailing Character Gives &quot;Bad File Name&quot; Error =

Article ID: 88258

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q88258



SUMMARY
The Microsoft Basic editing/debugging environments (QB.EXE, QBX.EXE) allow you to load multiple source files (that is, modules) for each program. To keep track of the specific modules for each program, the environments create project files with a .MAK extension. The project file is a simple ASCII file that lists each module in the project on a separate line. If any of the module filenames have trailing characters, even spaces, the environment stops reading and reports a &quot;Bad file name&quot; error.



MORE INFORMATION
This problem does not occur for project files created by the editing/debugging environment (QB.EXE or QBX.EXE). Because project files are simply text files, they can be created or modified manually. If any extraneous characters are inserted past the end of the filename extension, the &quot;Bad file name&quot; error will result. This can be particularly hard to detect if the inserted characters happen to be spaces or tabs.

Steps to Reproduce Problem
  Launch QB.EXE (or QBX.EXE) and type in the following code: PRINT &quot;In module 1&quot; CALL Sub1   From the File menu, choose Create File, and specify TEST2.BAS as the filename for this module. Choose the OK button. Add the following code to the new module: Sub Sub1 Print &quot;In module 2&quot; End Sub  From the File menu, choose Save All. You will be prompted for a filename for the original &quot;Untitled&quot; module. Specify TEST1.BAS as the filename for this module. Choose OK. QB.EXE (or QBX.EXE) creates a project file with the name of TEST1.MAK. You should now have the following three files in your current directory:

TEST1.MAK

TEST1.BAS

TEST2.BAS

 Exit QB.EXE (or QBX.EXE). Re-enter QB.EXE (or QBX.EXE), and specify TEST1.MAK on the command line as your project filename. TEST1.BAS and TEST2.BAS will be loaded. Because the project file has not been modified, both files should load with no problems. Exit QB.EXE (or QBX.EXE) and open TEST1.MAK in a text editor. Modify it so that there is a trailing space after the TEST2.BAS filename. Re-enter QB.EXE (or QBX.EXE). The editor will display the &quot;Bad file name&quot; error.</li></ol>

The QB.EXE and QBX.EXE editors assume that the filenames listed in a project file are valid and make no effort to remove trailing white space characters. When manually editing (or creating) project files, be sure to always specify valid, existing filenames, and do not leave any white space characters following the module filenames.

Additional query words: BasicCom 4.00 4.00b 4.50 7.00 7.10

Keywords: KB88258

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.