QuickBASIC


The following topics are discussed in this section:

GENERAL INFORMATION

Microsoft QuickBASIC, version 4.5, is a fully integrated package that contains an editor, a compiler, a linker, and a debugger. You can create programs that run by themselves or with the help of the BASIC run-time library module.

GETTING STARTED

The QuickBASIC package comes with two programs. The first program is the compiler, which creates an executable file from your BASIC source code. To compile and link your source code, use the MSB command followed by your filename and then press the [ENTER] key.

You can also create executables from the integrated environment. To run the environment, issue the command QB and press [ENTER] . To edit a specific file, specify the filename after the QB command and before you press [ENTER] . The environment works well with a mouse, so the LAN will automatically load the mouse driver (if it is not already loaded) before placing you in the editor.

USING QUICK BASIC

When you first execute the environment, you will be placed in the editor. At the top of the editor is the main menu. The line below this contains the name of the file currently being edited. If the file has no name, the word Untitled will appear. On the far right of this line will be an arrow. If the arrow only points up, it means the editor does not fill up the entire screen. To expand the editor window, place the mouse cursor on the arrow and [Left Mouse Button] . When the arrow points in both the up and down directions, it means the editing window occupies the entire editing area. Clicking the [Left Mouse Button] on this arrow will cause the window to reduce to its size before the window was expanded.

At the bottom of the screen is a reference bar. This line contains information such as which key displays help, information about the currently selected menu option, the status of the CAPS LOCK and NUM LOCK keys, and the current column and row position of the cursor.

Above this reference bar is the immediate window. This window is used to test your programs and perform calculations. You cannot, however, load files into this window.

Each window will have scroll bars at the bottom and right of its borders. The scroll bars can be used to display where you are in the file displayed as well as move to a specific location within the file. Your position in the file is denoted by the position of the black box on the specific scroll bar. If the black box is half-way between the ends of the scroll bar, then you are currently viewing the middle of the document. To move to another area of the file, place the mouse cursor on the desired side of the black box and press the [Left Mouse Button] . If the cursor is below the black box, the window moves down one page in the file. If you click above the black box, the editor moves the displayed text up one page. The same method can be used to with the horizontal scroll bar to move right and left in the document.

Using the Menus

The main menu is located on the top line of the screen. There are several ways of selecting an option from the main menu. The first, and easiest, is to place the mouse cursor on the desired option and click the left mouse button. A submenu will appear from which you can select the desired option. Another approach is to hold down the [ALT] key and press the capitalized letter of the desired menu option. The third method of selecting a command from the main menu is to press the [ALT] key and then use the arrow keys to highlight the desired option. Pressing the [ENTER] key while the option is highlighted will cause that command to be executed.

If you decide you want a main menu command other than the one you have currently selected, use the [Left Arrow] and [Right Arrow] keys to choose the new option. Another method is to place the mouse cursor on the new option and press [Left Mouse Button] .

Keyboard shortcuts are displayed next to certain options in submenus. These shortcuts specify the keyboard equivalent for the specific submenu option. To specify the option, press the specified keyboard combination.

Using the On-line Help

There are several ways to display the on-line help. The first is to highlight the command for which you are requesting help, and press the [F1] key. You can also select the Help menu option, and the menu will present four options.

The Index option displays an alphabetical list of all the keywords in QuickBASIC. You can get help on a specified keyword by placing the cursor on the specified keyword and clicking the [Left Mouse Button] . The Contents option displays a list of categories from which you can select for further help. The Topic option displays help for the keyword located under the cursor in the edit window. If the cursor is not on a word, this option will be unavailable. The Help on Help option explains how to use the on-line help facility.

When a topic is displayed, a menu will appear at the top of the help window. You can select any of the menu commands by placing the cursor on the desired command and pressing the [Left Mouse Button] . At the end of the help information will be a list of related keywords. You can display help on any of these keywords by selecting it with the mouse or using the [TAB] key.

To exit help, press the [ESC] key. This will remove the help window and place the cursor back in the editing window.

Help is also available for symbols in your own program. For example, if you wanted to see what type a variable was, you could place the text cursor on the variable and press [F1] .

QuickBASIC provides the ability to print the on-line help to a printer. To do this, choose the File | Print command from the main menu while the Help window is the active window. When you choose this command, a dialog box of options will appear. The Selected Text option will print only that text which is selected. The Active Window option will print the contents of the active window. The Current Module option will print the contents of the window you are currently viewing. The All Modules option will print the contents of all the programs loaded in memory.

Many of the commands listed in the on-line help come with sample programming code. QuickBASIC lets you copy this code from the Help window to your program. To do this, display the desired sample code in the Help window. You can then use the cut and paste facilities mentioned later in this manual to copy the selected text from the Help window to your program.

Using Dialog Boxes

Dialog boxes appear whenever you choose a menu command that is followed by three dots. They are used to get information from you so that the specific command can be executed. Dialog boxes are split into several boxes. The first type of box is a text box, you use to get a string you type on the keyboard. The List box displays a list of choices from which you are to select. The command buttons are usually displayed at the bottom of the dialog box. Buttons can be activated by placing the cursor on them and then pressing [ENTER] or [Left Mouse Button] . Option buttons will display a small dot if the option is active. Check boxes will display an "X" if the option is selected.

Quitting QuickBASIC

The option to quit QuickBASIC can be found in the File menu. To exit, choose the File and then the Exit menu options (File | Exit). If any changes were made to your program since the last save, QuickBASIC will ask if you wish to save the file now. To save the file, press [ENTER] . You will be asked to name the file if this is your first time saving the file.

Manipulating Windows

QuickBASIC has four window types in the environment. The first type is the View window. The View window is where most of your programming is done. The Immediate window is the second type, and is used to test a line of code or do calculations. The Help window appears when on-line help is requested. The fourth window is called the Watch window, and is where the values of specified variables are displayed while you are debugging your program.

QuickBASIC only lets you use one window at a given time, even though more than one may be displayed on the screen. The window in which you are currently working is called the active window. The active window is differentiated by having its title highlighted. To make another window the active window, press the [F6] key. This will cycle through all the windows opened in QuickBASIC. To cycle backwards through the list, press [SHIFT][F6] . If you are using a mouse, you can make a window active by placing the mouse cursor within the window boundaries and clicking the [Left Mouse Button] .

QuickBASIC provides several means of configuring the windows on your screen. To increase the size of the window so that it is displayed on the entire screen, press [CTRL][F10] . To reduce the window back to its original size, you can press [CTRL][F10] again. To expand a window by only a few lines, press the [ALT] [+] key combination for each line you want added. You can reduce the size of a window by one line by pressing the [ALT] [-] key combination. The [+] and [-] represent the plus and minus keys on the numeric keypad. These functions require that the Num Lock must not be set.

It is also possible to configure the size of the window by using the mouse. To change the size of the window, place the mouse cursor on the title bar of the window you wish to change. While pressing the [Left Mouse Button] drag the border to the desired location on the screen. When you release the button, the window will be resized.

The View Window

When you load a program from disk or start a new program, the source code will appear in the view window. The view window will have two cursors tracking your position. The first is the text cursor which shows the position where any input from the keyboard will be entered. The second cursor is the mouse cursor. It is used to choose commands, display help on the selected word, manipulate the text window, and place the text cursor at a specific location.

The text cursor can be moved by typing text or using the direction keys. The [Left Arrow] , [Right Arrow] , [Up Arrow] , and [Down Arrow] keys can be used to move the text cursor one character to the left, right, up, or down respectively. The [Home] and [End] keys can be used to move the cursor to the beginning or end of a line respectively. If the program is larger than the window, the [PG UP] and [PG DN] keys can be used to move up and down one screen within the program. Pressing [CTRL] with the [Left Arrow] or [Right Arrow] keys will move the cursor to the beginning of the previous or next word. [CTRL] used with the [Home] and [End] keys will move the cursor to the first or last line displayed on the screen. When used with [PG UP] and [PG DN] , the [CTRL] key moves the cursor to the right or left by one screen.

The Immediate Window

The Immediate window is displayed at the bottom of the screen. Commands in this window will be executed when you place the cursor on the command and press [ENTER] . You can put more than one statement on a line by separating them with the ":" character. This is useful for testing lines of code before placing them in your program.

The Watch Window

The Watch window is used to display the values of specified variables. This lets you watch the values stored in your variables while you step through your program. Since one of the major reason for program failures is an incorrect value in a variable, this is a useful debugging tool.

You can tell QuickBASIC which variables to watch by issuing the Debug | Add Watch command from the main menu. You should then enter the name of the variable to watch. QuickBASIC will then display the program name, variable name, and its value in the Watch window (located above the View window). To remove a variable from the Watch window, choose the Debug | Delete Watch command.

The Help Window

The Help window is displayed whenever the on-line help facility is requested. This can be done by choosing the Help command from the main menu, or pressing [F1] . In either case, QuickBASIC will display the on-line help associated with the word under the cursor.

The help window is split into two parts. The section at the bottom of the window is called the QuickSCREEN and contains the requested information about the command. The top of the window contains items called hyperlinks. Hyperlinks are connections to another entry in the on-line help system. Hyperlinks will be topics related to the one you are currently viewing. To activate a hyperlink, place the mouse cursor on the desired topic and click the [Left Mouse Button] . You can also use the [TAB] key to move the text cursor to the desired topic and hit [ENTER] . Pressing [ALT] [F1] will return you to the previous topic before you activated the hyperlink connection. QuickBASIC, however, only remembers the last twenty hyperlinks, so you cannot back up more than twenty connections. Pressing [ESC] will close the Help window, no matter how deep you are in the hyperlinks.

Copying and Pasting Blocks of Text

QuickBASIC lets you select a block of text so you can perform an operation on it. You can select a block of text by placing the text cursor at the beginning of the text to be selected, and then hold down the [SHIFT] key while pressing the arrow keys. QuickBASIC will automatically highlight the text as you move the cursor. You can perform the same operation with the mouse by placing the mouse cursor at the beginning of the text to be selected. While holding down the [Left Mouse Button] , move the mouse cursor to the end of the block. QuickBASIC will automatically highlight the text as you move the mouse. You can remove the highlight by pressing one of the arrow keys or clicking the [Left Mouse Button] .

Pressing the [DEL] will delete the text permanently from the file. To move the selected text from one position to another within the file, press [SHIFT][DEL] . This places the selected text on an electronic clipboard. You can then press [SHIFT][Insert] to move the selected text from the clipboard to the current text cursor's position. Each time you push [SHIFT][Insert], the contents of the clipboard will be pasted into the program. To copy the selected block, press [CTRL][Insert] to copy the block to the clipboard. You can then press [SHIFT][Insert] to paste the clipboard's contents in the file at the text cursor's position. Text placed on the clipboard remains there until a new selection is placed onto the clipboard.

You can also replace a block of selected text. To do this, first select the block of text to be replaced. Next, type the new text to replace the selected region. As soon as you press a key, QuickBASIC will automatically delete the selected text and insert, at its position, the new text you are entering from the keyboard.

Opening and Starting a New File

To start a new program, issue the File | New Program command. If a program is currently loaded in the View window, QuickBASIC will ask if you wish to save your changes before clearing it from memory.

The Create File command is used to create a new file that is part of the current program in memory. This is useful for making separate libraries or modules. When this command is chosen, a dialog box will appear. In this box, you must specify the name of the file to create and tell what its file type will be. A module is a collection of BASIC commands. An include file is a text file whose contents are placed in your program after the $INCLUDE metacommand is found. A document file is a simple ASCII text file.

The File | Open Program menu command is used to load a previously saved program into the View window. QuickBASIC can open files saved in either ASCII or QuickBASIC formats. When this command is issued, a dialog box will appear where you can choose the file to open. To select a file, place the mouse cursor on the desired file name and double click the [Left Mouse Button] . Changing the file pattern in the File Name box will change the files displayed in the Files window. If the file to load is on a drive or subdirectory other than the current one, place the mouse cursor on the desired drive letter in the Dirs/Drives box and double click the [Left Mouse Button] .

The Load File command loads the specified single module, include, or document file into memory. You can specify the name of the file and its type in the dialog box that is displayed when you choose this command. Once a file has been loaded into memory, you cannot reload it until you chose the Unload File command to remove the file from memory.

The Merge command can be used to place the contents of one file into another. Issuing this command will cause a dialog box to be displayed. From this box, you should choose the file you wish to load. When you hit [ENTER] after typing the file name, the contents of the file will be placed at the current text cursor location in your current program.

Saving Your Program

There are several ways to save your program to a disk. The preferred method is by issuing the File | Save command. This command will save your file to the disk in a QuickBASIC format. If the file has not been saved previously, a dialog box will appear asking for a name for the file. If the file already exists, the old version will be deleted and the new version saved in its place.

The Save As command is used to save the program under a different file name. When this command is issued, a dialog box appears. In this box, enter the new name for the file and press [ENTER] . QuickBASIC will then save the file under the new name and in a QuickBASIC format. If you wish to save the file in an ASCII text format, place the mouse cursor on the Text option and click the [Left Mouse Button] . Files saved in this format are readable by other programs such as text editors and BASIC interpreters (such as BASICA).

The Save All command is used to save all files that are loaded into memory. This is useful for saving changes to modules and include files that can be loaded into memory with your main program. This command will automatically replace any old versions of the files when it saves them.

Printing Your Program

QuickBASIC provides a facility for printing your programs. To print your program, all files loaded, or a section thereof, use the File | Print command. When this command is issued, a dialog box will appear. From this box, you can specify which items are to be sent to the printer. If you choose the Selected Text option, all text that is currently selected in the active window will be sent to the printer. The Active Window option will send all text in the active window to the printer. The printer will receive the program in the current window when you choose the Current Module option. To print the entire program and all its loaded subprograms, choose the All Modules option. After selecting the desired group to print, click the [Left Mouse Button] on the < OK > button or press [ENTER] to have the text sent to the printer.

The View Menu

The View menu contains options for displaying various program components as well as moving files in and out of the View window so they can be edited. One of the more useful views is that of your program's output. To see the output screen, press [F4] . To return to your program, press the [ESC] key. The View | Next Statement option will move the cursor to the next source line to be executed. The Split option is used to divide the View window horizontally.

The first two options in the View menu provide support for subroutines. Pressing [F2] will display a dialog box of all the loaded modules and subroutines. To edit one of these routines, place the mouse cursor on its name and click the [Left Mouse Button] . To display the file in the View window, click the [Left Mouse Button] on the Edit in Active option. Clicking the [Left Mouse Button] on the Edit in Split option will split the View window horizontally and place the selected file in the new split window. The Move option will display a dialog box from which you are to select the destination module to move the originally selected procedure. In the list, QuickBASIC will place module names in all capital letters and procedures will be indented below their respective module and only have their first character capitalized. Pressing [SHIFT][F2] will display the next alphabetical procedure in the View window.

QuickBASIC also provides facilities for viewing and editing include files with the last two commands in the View window. With the text cursor on a line that includes a $INCLUDE statement, choosing the Included File command will place the include file in the View window. The Included Lines command is a toggle that allows or disallows the editing of the include files. When this option is on, a dot will appear to the left of the command in the View menu and you will not be allowed to edit the file. To edit, press the [ENTER] key twice.

Searching and Replacing Text

QuickBASIC provides a sophisticated search and replace mechanism. To search for a particular string, bring up the search prompt by pressing [ALT] [S] [F] . You will then be asked for the string to find. Enter the string and press [ENTER] . QuickBASIC will highlight the next occurrence of the specified string. Pressing [F3] will highlight the next occurrence in the file. When the end of the file is reached, QuickBASIC automatically continues the search at the beginning of the file.

Replacing text works in a similar manner to searching for text. To replace text, press [ALT] [S] [C] to display the text change query box. In the query box, enter the string to be replaced. Then, press the [TAB] key and enter the string to be used to replace the old text. After both fields have been entered, press the [ENTER] key. QuickBASIC will then search for the specified string and highlight it when found. QuickBASIC will then ask if you wish to change the current finding. If you do, press the [ENTER] key. QuickBASIC will then continue the search, prompting you with each find if you wish to change the text.

QuickBASIC provides many options for search and replace operations. When you first request a search, two options will appear to the left of the dialog box. If you click the [Left Mouse Button] on the Match Upper/Lowercase option, QuickBASIC will only highlight those strings that match the exact case of the search string you entered. The Whole Word option forces QuickBASIC to match the string only if it is a complete word, i.e. not part of another word. The Search box lets you specify which windows will be searched. The Active Window option will force a search in the active window only, no matter what window you are currently in. The Current Module option will search only the current file in the View window. The All Modules option will search all programs loaded in memory.

When performing a change operation, you also have several choices. At the bottom of the query box will be some options to control the change. The Find and Verify option will find each occurrence and prompt you before making the change. This is the default option when you press [ENTER] . The Change All option will automatically find all the occurrences of the search string and replace them with the change string. When the first choice is found and you specified the Find and Verify option, you will be asked if you wish to make the change. At the bottom of this window will be a list of options. The Change option will make the change and continue the search. The Skip option will skip this occurrence and search for the next one. The Cancel option will terminate the search operation.

Another search option is the Search | Label command. This menu command lets you search your program for a specific label. When you enter the label name and press [ENTER] , QuickBASIC will highlight the label and move the text cursor to the label's location in the program.

Using the Smart Editor

QuickBASIC's editor provides a special feature called the "smart editor." Every time a new line is entered into the editor, the smart editor checks the line for syntax errors, formats the line as necessary, and compiles the source line in memory. The smart editor is turned on by default. To disable the smart editor so you can type a document or data file, select the document option after issuing a File | Create File or a File | Load File command.

When the line entered contains an error, the smart editor will display an error message. Pressing [ESC] will clear the message and place the cursor on the location within the line where the error occurred. Your program will not run until all syntax errors are corrected. The smart editor will not flag a misspelled command as an error, because it assumes you are defining a new subroutine.

After pressing [ENTER] on a line with no syntax errors, the smart editor will automatically convert all BASIC keywords to uppercase. It also matches the capitalization of variables you have previously defined or used. It will insert spaces before and after all the BASIC operators and adds punctuation in places where you forgot to place it.

Running a Program

After the program has been entered, you can try to execute it. To run your program, press [SHIFT][F5] or choose the Run | Start command from the main menu. If no errors exist in the program, QuickBASIC will automatically start executing your program. If an error exists, QuickBASIC will display a message describing the error and will highlight the error in the program. If more than one error exists, you must correct the first error and try to run the program again for QuickBASIC to show you the error. The Run | Restart command clears all variables and executes the program. This is useful if you wish to execute the program from the beginning instead of continuing from the current location. The Continue option will continue executing the program from the last point of execution.

By default, QuickBASIC does not create an executable file. You can create one, however, by choosing the File | Make EXE File command. This will display a dialog box where options can be set. The first, is the name of the executable file. By default, it will be the same name as the main module. Checking the Produce Debug Code will place special debugging information for use with Microsoft Code View in the executable file. This option also enables the [CTRL][Break] sequence during execution. The default executable file requires the use of the BRUN45.EXE file in the computer's search path to run. To create an independent executable file, click the [Left Mouse Button] on the Stand-Alone EXE File option. After setting the desired options, click the [Left Mouse Button] on the Make EXE or the Make EXE and Exit option.

Debugging a Program

Sometimes your program will run without QuickBASIC saying there are errors, but it does not run properly. To help you find these "run-time" errors, QuickBASIC provides some debugging tools. The first is the [F7] key. When you press this key, QuickBASIC runs your program up to the line that contains the text cursor. Pressing the [F8] key will execute the next line of code in your program. This is useful for stepping through your program one line at a time when trying to find an error. If the next line is a procedure call, [F8] will step through the procedure. The [F10] works in a similar manner to the [F8] key except it executes procedure calls as if they were one statement.

To specify certain lines where you wish execution to stop, you can place a break point. A break point tells QuickBASIC to stop executing the program so you can examine your variables. Pressing [F9] will place a break point on the current line. To signify a break point, QuickBASIC will change the color of the line in your program. To run your program up until the break point, press [SHIFT][F5] . If you press [F9] on a line that already contains a breakpoint, QuickBASIC will remove it. You can also choose the Debug | Clear all Breakpoints menu command to clear all breakpoints throughout the program.

QuickBASIC provides another form of break point called a watchpoint. A watchpoint specifies a certain condition that causes program execution to stop so you can examine the values of your variables. A watchpoint is set by using the Debug | Watchpoint command. Enter the condition and press [ENTER] . The condition will be placed in the watch window and followed by either < FALSE> or < TRUE> depending upon the result of the condition. When you run the program, QuickBASIC will stop execution of the program when the condition becomes TRUE.

Most run-time errors occur because a variable has an incorrect value. To watch the values of certain variables, you can specify a watch. To do this, choose the Debug | Add Watch command from the main menu. QuickBASIC will then ask for the variable you wish to watch. Enter the variable name and then press [ENTER] . QuickBASIC will display the variable's name and value in the Watch window. To remove a watch from the Watch window, choose the Debug | Delete Watch command. QuickBASIC will display a list of all the watch variables. Use the arrow keys to highlight the watch to delete and press [ENTER] . Choosing the Debug | Delete All Watch command will remove all watches from the Watch window.

The Debug menu command has a few other options for debugging your program. The Trace On option steps through your program in slow motion, highlighting the line being executed as it runs. The Set Next Statement option will highlight the next command in your program to be executed. The Break On Errors option will stop execution when an ON ERROR statement is invoked.

Another option in the Debug menu is the History On option. This option will record the last twenty lines of your program that were executed, so you can trace back the last statements executed before QuickBASIC terminated execution with a run-time error. You can step backwards through this list of commands by pressing [SHIFT][F8] . You can step forward through the history list by pressing [SHIFT][F10] .

Pressing [SHIFT][F9] will bring up the Instant Watch dialog box. This box lets you enter a variable whose value you wish to examine. When the dialog box is displayed, you are asked for the expression to evaluate. When you hit [ENTER] , QuickBASIC will display the value in the Value box. Clicking [Left Mouse Button] on the Add Watch button will add the variable to those in the Watch window.

The Calls menu command displays the calling sequence of procedures within your program. This is useful for finding the calling sequence of nested procedure calls when a program crashes. The current procedure will be listed at the top, and the oldest at the bottom. The entry at the bottom of the call stack will be your main program.

It is also possible to use BASIC commands for debugging. Commands such as STOP, PRINT, CONT, TRON, and TROFF are useful for tracing the flow of a program.

Function Key Definitions

The following table gives a brief description of the functions assigned to the specified function key combinations.

Keys          Brief Description
-------------------------------------------------------------------------------
[SHIFT][F1]   Displays a general help screen
[F1]          Displays help on the word under the cursor
[ALT][F1]     Displays a previous help screen (up to 20)
[F2]          Displays a list of SUB or FUNCTION files
[SHIFT][F2]   Displays the next procedure
[CTRL][F2]    Displays the previous procedure
[F3]          Finds the next occurrence of the specified string
[F4]          Displays the output screen
[F5]          Continues program execution after stopping
[SHIFT][F5]   Runs the program from the beginning
[F6]          Activates the next window
[SHIFT][F6]   Activates the previous window
[F7]          Runs the program up to the current cursor position
[F8]          Executes the next command, or trace into a procedure
[SHIFT][F8]   Steps back through your program if History On
[F9]          Sets or removes a breakpoint
[SHIFT][F9]   Brings up the Instant Watch box
[F10]         Runs next command or procedure
[SHIFT][F10]  Steps forward through your program if History On
[CTRL][F10]   Toggle between window and full screen view

Converting BASICA Programs

QuickBASIC accepts most programs written in DOS's BASICA and GW-BASIC. To load a program written with DOS BASIC into QuickBASIC, you must have DOS BASIC save the file with the ,A option. This saves the file as an ASCII file so that QuickBASIC can load the file into memory. If the ,A option is not specified, the file is saved in a compressed format and will be unreadable by QuickBASIC.

QuickBASIC does not support all the commands available in DOS BASIC. Commands that interface a cassette player and editing of the source program are not permitted since cassette players are no longer used with PCs and QuickBASIC provides its own editor. These commands are not supported: AUTO, CONT, DEF USR, DELETE, EDIT, LIST, LLIST, LOAD, MERGE, MOTOR, NEW, RENUM, SAVE, and USR. The following statements are supported in QuickBASIC but require modifications: BLOAD, BSAVE, CALL, CHAIN, COMMON, DEFtype, DIM, DRAW, PLAY, RESUME, and RUN. For details on these modifications see the on-line help or the Microsoft QuickBASIC Reference Manual.

Compiling and Linking From DOS

QuickBASIC also provides programs that let you create executable files from the DOS prompt. This lets you use your favorite text editor to create the programs.

After saving your program with the text editor, you must compile and link it to create an executable file. To do this, enter the command

MSB filename

where filename is the name of your source file. Press [ENTER] to accept the default object file name. If you wish to have a listing file produced, enter the name of your program followed by [ENTER] . Pressing [ENTER] will tell QuickBASIC not to create a listing file. If no errors exist in the source code, it will automatically run the linker to convert the object code to an executable file. If errors are found, they will be displayed on the screen along with the corresponding line number. You can also use the listing file (if you requested one be created) to help find the errors.

When the linker is run, it will first ask you for the name of the executable file. To choose the same name as the source code, hit [ENTER] . Next, it will ask for the name of the map file. If you are not producing debug information in the executable, hit [ENTER] to specify that no map file is to be produced. The next question asked by the linker is for any libraries used by the program. If your program uses any libraries, enter their filenames here. To make a stand-alone executable, enter the library name BCOM45. If you do not specify this library, the executable will not run without the use of the Microsoft run-time library executable.

HELPFUL HINTS

When dealing with long programs, it is helpful to use placemakers to mark specific locations in your program. To mark a line, place the text cursor on the line and press [CTRL][K] followed by a place number. To go to that placemark, hit [CTRL][Q] followed by the desired place number.

When working on machines with math coprocessors, it is best not to place calculations within a condition. In these situations, the result of the calculation is stored in the math coprocessor's registers and may be more accurate than the comparison allows.

QUESTIONS/ANSWERS

Q. Can I still use line numbers in my BASIC programs with QuickBASIC?

A. Yes, QuickBASIC allows, but does not require the use of line numbers.

REFERENCES/MANUALS

For a complete list of QuickBASIC commands and options, please see the Microsoft QuickBASIC manual.

Your local bookstore should have third party reference manuals on programming in Microsoft QuickBASIC.

EXAMPLES

INPUT "How old is your pet? ",age
INPUT "What is the name of your pet? ",petName$
SELECT CASE age
  CASE IS <  0, IS >  100
    PRINT "I do not think so"
  CASE 1 TO 3
    PRINT "Ahh, just a baby"
  CASE 4,6,8
    PRINT "Young, even aged animal"
  CASE ELSE
    PRINT "Rather dumb example, I admit"
END SELECT
FOR loopVar = 1 TO age
  PRINT "We wish "; petName$; " a happy birthday!"
NEXT

(c) Copyright UCF Computer Services I& R Support 08/25/93