Project File Trailing Character Gives "Bad File Name" Error (88258)



The information in this article applies to:

  • Microsoft QuickBASIC 4.5
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 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 "Bad file name" 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 "Bad file name" error will result. This can be particularly hard to detect if the inserted characters happen to be spaces or tabs.

Steps to Reproduce Problem

  1. Launch QB.EXE (or QBX.EXE) and type in the following code:
       PRINT "In module 1"
       CALL Sub1
    						
  2. 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 "In module 2"
       End Sub
    						
  3. From the File menu, choose Save All. You will be prompted for a filename for the original "Untitled" 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

  4. Exit QB.EXE (or QBX.EXE).
  5. 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.
  6. 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.
  7. Re-enter QB.EXE (or QBX.EXE). The editor will display the "Bad file name" error.
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.

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