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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I save QBASIC files so they can run on their own?

Status
Not open for further replies.

qbasictrainee

Technical User
Jun 2, 2007
2
0
0
US
^--- QBASIC newb in training.
That being said, how can I save a QBASIC file such that it can be run independent of QBASIC? So far I've made little programs within it and run them fine just by pressing F5, but how can I save them such that they will run on their own, outside of QBASIC?
Any help would be greatly appreciated :).
 
QBASIC itself does not generate stand-alone files. QuickBasic, on the other hand, does. Search the net for Quick Basic 4.5 for a download.
 
Once you have a qbasic program that works and you want to execute it in a batch file do the following after saving it.

1 be sure to use fully qualified names for everything.
2 change the "END" statement with a "SYSTEM" statement.
it ends the program and returns to the command level.
3 use only 8 character names for file/folder names.
qbasic doesn't support longer file nAMES.

to execute do the following use fully qualified names everyplace.

on your bat file you could specify "FILEA.TXT" as the first parameter which is %1 in the bat file

ENTER THE BAT FILE TO EXECUTE:

MYBAT.BAT FILEA.TXT

then IN BAT FILE:

SET XYZ=%1

then when you want to run the program use the "/RUN" option

C:\qbasic\qbasic /RUN C:\PAYROLL\PAYREG.BAS

In your program you can get the value of xyz by

myxyz$ = environ$("xyz"

I discussed moue than you asked for but thought thses would be likely followup questions.

QBasic is better then most people think it is. Also get a copy of QuickBasic if you want or TurboBasic both of then generate compiled executable programs once you get used to the PDE/IDE.

Computer thought: I teach a lot of programming so I can learn. You can never learn it all.
 
I managed to save the game I found as a .exe, but when I try to play it my entire screen goes black. Tried this with other QBASIC games also...as I'm trying to learn QBASIC to make games it's a bit disconcerting that I can't play any of them...anyone know what the problem is o_O?
 
Qbasic isn't a very good language for games because of it's lack of Windows type "window support". It's screen options are pretty limited and if you are trying to run the program under windows in XP then the system has to emulate qbasic options.
Example: with different characteristics such as QBasic with 16 colors on 640x480 within an Windows/XP 1200x800 with 16 million colors.

I am not into gaming so I can not help.

Computer thought: I teach a lot of programming so I can learn. You can never learn it all.
 
I'd do what PROFESSORSPARKIE said above and run your program through a batch file.

[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top