Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding out QBASIC version 1

Status
Not open for further replies.

infinitysquadron

Programmer
Aug 2, 2002
20
CA
Is there a way for a program to detect which version of QBASIC it's being run on? So the user can be alerted if the program wont work on their version?
 
I don't think there is a way to do that... but why would you want to? Why not just put a few lines of comments at the top. Like this:

' =======================================
' My program name
' Version number and status (fe: BETA)
' Copyright information
' Created for QBasic x.x
' =======================================
 
Since my program wont compile to an exe, I'm making it "look" as if it is compiled by having it run from a batch file. Therefore the user will never see the code anyway. I also need the batch file to invoke some of the parameters like /AH
 
Why does it fail to compile? If you are using QBasic 1.1, the source shoud work on everything anyway...
 
I get a few Memory Overflow errors and some Expression too complicated errors. I don't know why, it works just fine when I run it in QBASIC (7.1). It isn't really that big of a deal anyway, I was just curious if there was a way to do this.
 
I see this problem far to often. QBasic's memory limits overloading... Most of my early programs routinly had this problem, but as I progressed in my programming ability I found this less and less of a problem.

True, QBasic's memory limitations can be a tough workaround... but I came to the conclusion that there is still no substitute for effecency in design. In fact, QBasic programmers are a truly exceptional group of skilled programmers because of the limits.

"For when you have no limitations, you never learn to progress beyond them." - S.R. Davis
 
You can compile (and link) some programs from the command line that won't compile from the IDE, too. Have you tried that yet?
 
I don't seem to get as many errors, but it still wont compile. I'm not real concerned about it though. I'm not done anyway. I don't understand those program memory overflow errors. If they run fine in QBASIC, you'd think they'd run fine compiled. But I guess not. And what about those "Expression too complicated" errors? What's too complicated for a computer? :)
 
"QuickBASIC Versions 4.0 and 4.5 support recursion, which is the ability of a procedure to call itself. Recursion is useful for solving certain problems, such as sorting. See Chapter 2, "SUB and FUNCTION Procedures," for more information about using recursion." (p. 324 - "B.1.5.12 Recursion")
(Microsoft QuickBASIC: Modern Programming System, 1990, Microsoft Corporation, Redmond,Washington)


You can try coding a procedure for recursion and if it fails then it is an eariler version of QB if not then it's at least QB 4 and above.

Example Below:

DECLARE SUB QBVer4 (Pass3Times)
TopOfRecursion:
CLS
ON ERROR goto InvalQB
QBVer4 PassMeIn
'...Continue with code...
END

'--error handlers--
InvalQB:
CLS: PRINT
PRINT "Invalid QB Version. Program Requires QBASIC ver 4.0 or better"
SYSTEM


SUB QBVer4 (Pass3Times)
IF Pass3Times >= 3 THEN EXIT SUB
Pass3Times = Pass3Times + 1
PRINT "Passed in =";
PRINT Pass3Times: SLEEP 1
QBVer4 Pass3Times
END SUB



I have NOT tested this on QB 1.1 so I can't say that this will provide the results listed in the OEM book at the top. But if someone can try it and report back, I'd appreciate it also.

--MiggyD
 
What the heck are you talking about? QBasic 1.1 is the very first version of QB they ever made! QB45 & QB71 came a few years later. However, QBasic 1.1 does support recursion.

I tried at one point to find out if I was running under QB71 by using the DIR$ command. Never could get that to work though... I assume that is a pretty dumb idea, but if anyone can come up with a way to do that...

The problem I ran into was that although the routine would work in QB71, making it work in any other version of QB required that I declare DIR$ as a function. This posed problems when trying to run it under QB71 again.
 
You should consider compiling the program. This way the user
will not be able to run it with the wrong compiler.
If you want the user to run program in the IDE you could try to catch the error produced by the missing functions.


By the way:
Dates in the splash - status line of my copies of
QB 4.0 1987
QB 4.5 1988
PDS 7.1 1990
QBasic 1.1 1993

QBasic 1.0/1.1 is just a downgraded QB4.5 Mr Gates made to give it for free with DOS and substitute the obsolete GWBasic.

Probably QuickBasic 1.0 existed once but it has nothing to do with the interpreter supplied with DOS and Windows. Antoni
 
Interesting but of history... I honestly thought QB 1.1 was the first... That's usuly what version numbers are for.
 
That's wierd. Why start with with version 4, then go to 1? That's very misleading. Maybe even a bit dishonest. Version numbers generally go up as products get newer. I've never heard of something like that. Can Bill Gates count?
 
Was there ever a QuickBasic 1.0... or was the first release issued at version number 4.0?
 
Yes there was a QB 1.0. My version of 1.0 was on DOS 3.x original OEM disks. I think ver 3.22 and 3.3 -- don't recall any more. Then I found QuickBASIC 4.5 on sale.

Also, QB 1.0 realy did have problems with 4.5 commands. Most of the time there were errors about commands not understood or found or something like that. So I stuck it out with 4.5 (and because it could compile.)

--MiggyD
 
Here's a little somthing that will give you the QB version "QB45" or "QB71"... I knew I could get it eventualy...

ON ERROR GOTO Handler
A$ = DIR$
QBVersion$ = "QB45"
Here:
Print QBVersion$
SYSTEM

Handler:
QBVersion$ = "QB71"
Resume Here

Pretty strange looking eh? Well, at least it works... I wanted to put all this is a function but QB45 does not support the "ON LOCAL ERROR GOTO" command.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top