home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
progbas
/
baswiz13.arj
/
QUESTION.TXT
< prev
next >
Wrap
Text File
|
1990-05-12
|
5KB
|
134 lines
Common Questions about QuickBASIC
After spending much time on CompuServe, BIX, the FidoNet QuickBASIC echo and
other national BASIC forums, I've noticed that there is a lot of repetition.
People ask the same questions, time after time. They must be good questions!
Here is a compilation of a few of the more common questions.
Question:
How can I disable Control-Break?
Answer:
Programs compiled with QuickBASIC or BASCOM usually don't have to worry
about this. Control-Break is disabled unless you compile with the /D
(debug) option. In the event that you are doing something that QuickBASIC
doesn't completely control, like printing to the screen via DOS functions,
this protection no longer holds. In that case, you may be able to disable
Break by getting DOS to check for it less frequently. Use the command
BREAK OFF
from a batch file, or execute it from BASIC like so:
SHELL "COMMAND BREAK OFF"
Question:
How can I get the error level from a SHELLed program? How can I get my
program to return an error level?
Answer:
You can't. More accurately, you can only do it with assembly language
routines. I'll add that capability to a later version of BASWIZ.
Question:
How can I get access to COM3 and COM4 for my communications program?
Answer:
You can't do that with BASIC alone, but BASWIZ will let you do it. Check
the BASWIZ.DOC manual and TERM.BAS example program.
Question:
How can I get a directory listing into an array?
Answer:
Most BASIC libraries can do this for you. Another way to do this is to
put the directory listing into a file by
SHELL "COMMAND DIR *.* >DIRLIST.TXT"
and then read the file into an array. Yet another alternative is to use
the FILES statement on a non-displayed screen page (if you have a CGA, EGA
or VGA) or in invisible colors (say, black on black), then get the results
off the screen with the SCREEN function.
Question:
How can I see if a file exists?
Answer:
Most BASIC libraries can do this for you. Or, you can use the directory
approach given above. Yet another way to do it is to try to open the file
for input:
ON ERROR GOTO NotFound
OPEN File$ FOR INPUT AS #1
CLOSE #1
Found = -1
Done:
RETURN
NotFound:
Found = 0
RESUME Done
Question:
I'm running out of string space. What can I do?
Answer:
If you have arrays, try moving them outside of the string space area.
Either use REDIM to dimension 'em or use the REM $DYNAMIC metacommand. If
this doesn't help enough, use fixed-length strings, which are stored
outside the regular string area. Still not enough room? Well, you can
buy Microsoft's BASCOM 7.0 "Professional Development System", which will
set you back about $300. Or, you can simply use the "far string" routines
provided in BASWIZ. See the BASWIZ.DOC manual for details.
Question:
I'd like to constantly display the time. What do I do?
Answer:
That's also available in libraries (gee, aren't libraries great?!). You
can do it yourself using an approach like this:
ON TIMER(1) GOSUB DisplayTime
TIMER ON
' your program goes here
DisplayTime:
OldRow = CSRLIN
OldCol = POS(0)
LOCATE 25, 70
PRINT TIME$;
LOCATE OldRow, OldCol
RETURN
Question:
I need to know how many days lie in between two dates. How do I do it?
Answer:
As usual... this is something you can get in a library from your local
BBS. Try QB4BAS. It's quite possible to do it in BASIC, but I can never
remember the proper formulae... you need to account for leap years and
leap centuries, so it isn't as straightforward as you might guess.
Question:
How can I use ANSI display codes?
Answer:
You need to go through DOS display functions for that to work. Use this:
OPEN "CON" FOR OUTPUT AS #1
This makes the DOS display functions available as file (device) number
one. You can print to it using normal file statements:
PRINT #1, CHR$(27); "[2J";
The above statement will clear the screen if an ANSI driver is installed.
See your DOS manual for information on the available ANSI codes. You can
also get this information from your friendly local BBS.