Chapter 8 - Qbasic Tutorial - Qbasic Tutorial - Qbasic Tutorial - ^^JPS^^
Saturday, 2016-12-03, 5:37 PM

Welcome Guest | RSS

MainRegistrationLogin
Qbasic Home

Catalog categories
Qbasic Tutorial [31]

Rate my Site
Rate JPSor Site
Total of answers: 149

Main » Articles » Qbasic Tutorial

Chapter 8 - Qbasic Tutorial

Before we get into some fairly big programs, let's look at how to save our masterpieces.

Location Is Everything

The first thing we need to think about is where we are going to save our programs. The two main places we can save things are the hard disk, and onto a floppy disk. Let's look at both places.

Saving To Floppy

Using a floppy is a good idea if you don't want other people looking at your programs. The floppy can be removed from the computer and kept in a safe place. Floppies are also good when you want to move programs from one computer to another.

Let's try it. Find a blank floppy and place it into the computer's floppy drive. The floppy can have stuff on it, as long as there is some free space left. You'll need to have a program up on the screen for this to work properly. Go back to the previous chapter and type in the example if you need to get something up on the screen.

Click on "File" on QBASIC's menu, then "Save".

The "Save" dialog will appear on the screen. Notice that the cursor is in a box (field) called "File Name:". Type this:

 a:\testsave

Be careful with that backslash "\". It isn't the same as the front-slash "/" which is on the same key as the question mark "?". QBASIC is very picky about this.

Press the <Enter> key. What happened? Did you hear something? Where'd the "Save" dialog go? Hmmmm, ok, hopefully that worked. How can we check? Let's try loading the program back into QBASIC. Wait, it's already there. Ok, then let's clear it out and try to get it back from the floppy. Remember how to get rid of a program? Hint: "File" then "New" on the menu.

Loading From Floppy

Let's do it. Click on "File" then "Open..." on QBASIC's menu. Now you will see the "Open" dialog. Type this:

 a:

and press the <Enter> key. Now you should see "TESTSAVE.BAS" in the box called "Files". Two clicks oughta do it. Double-click on "TESTSAVE.BAS" and the program is back from the floppy.

Saving To Hard Disk

The hard disk is the most convenient place to save programs. Since it is always in the computer, your programs are always there for you to load when you need them.

Neatness Counts, Again

Hard Disks usually have a lot more information on them than a floppy. Because of this, you need to be concerned about keeping things neat. You'll never be able to find what you need otherwise. The best way to organize your collection of programs is to put them into a "subdirectory" or "folder" on the hard disk.

Making Your Own Subdirectory

Let's make a folder on the hard disk for our programs. In Windows 95 we will need to use Windows Explorer. In Windows 3.1 we will use File Manager. First, the Windows 95 way.

Making a Folder With Windows 95

Click on the "Start" button, then "Programs", then "Windows Explorer".

Now click on "File", then "New >", then "Folder" on the Windows Explorer menu.

Notice the words "New Folder" on the right-hand side of Windows Explorer.

Go ahead and type in a name for the new folder, but keep it short! QBASIC is an older program that can't handle names bigger than 8 letters or numbers. I called mine "TedsPrgs" meaning Ted's Programs. Call yours whatever you want, but no more than 8 characters, or it will look real funny to QBASIC.

Press the <Enter> key to create the folder. Good, that's done. We won't need to do that again, unless you'd like to make another directory at a later date. Go ahead and close Windows Explorer and get back to QBASIC.

Making a Folder With Windows 3.1

...

Saving In The Directory

Saving to the hard disk is only a little different from saving to a floppy. You'll need to have a program up on the screen to save. Go back to the previous chapter and type in the example if you need to get something up on the screen.

Click on "File" on QBASIC's menu, then "Save".

The "Save" dialog will appear on the screen. The cursor is in a box (field) called "File Name:". Type this:

 c:\TedsPrgs

Once again, watch the backslash "\". Change "TedsPrgs" to whatever you named your directory.

Press the <Enter> key. Now you will see a list of programs in that directory. Since you haven't saved anything yet, there shouldn't be any programs there. Go ahead and type this:

 testsave

and press the <Enter> key. Hmmm, no sound at all that time. Hard disks are much more quiet than floppies. So, let's make sure it worked properly. First, get rid of what's on the screen with a "File" then a "New".

Loading From Hard Disk

This is also very similar to the way we loaded a program from floppy. Click on "File" then "Open..." on QBASIC's menu. This will bring up the "Open" dialog. Type this:

 c:\TedsPrgs

Like before, watch the backslash "\" and change "TedsPrgs" to whatever your folder was called.

Now you should see "TESTSAVE.BAS" in the "Files" box. Double-click on "TESTSAVE.BAS" to load it.

That wasn't too bad, was it? Once you figure out whether you want to save to floppy or hard disk, you only need to remember one way to save and load.

Learned

  • Saving to floppy
  • Loading from floppy
  • Creating a folder
  • Saving to hard disk
  • Loading from hard disk


Source: http://jpsor.ucoz.com
Category: Qbasic Tutorial | Added by: JPSor (2009-02-26) | Author: JPSor
Views: 1180 | Rating: 3.0/1 |
Login

Qbasic Clock

Search

Visit my Friends

Who's Online

Total online: 1
Guests: 1
Resgistered: 0


Copyright MyCorp © 2016