home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Supreme Volume 6 #1
/
swsii.zip
/
swsii
/
201
/
IO1093.ZIP
/
FTUR05.TXT
< prev
next >
Wrap
Text File
|
1993-09-30
|
6KB
|
134 lines
By Paul Shapiro
Saving Space
You may be using more hard disk space than you realize! When you
look at a DIRectory, you probably think that the number of bytes
shown for each file is the number of bytes devoted to the file
shown. Wrong! It is just the number of bytes required for the
substance of the file. Hard disk space is assigned in clusters.
A whole cluster is assigned even if only one byte (or character)
is needed. But how big is a cluster? That is easy to find out.
Display your current directory. Write down the number of free
bytes shown as remaining on your hard disk. If your DIR display
does not show this, you may get the same information by running
the CHKDSK utility of DOS.
Then create a short file, SHORT.TXT, by issuing the command echo
My Monitor >> short.txt.
Then type TYPE SHORT.TEXT to see ten characters just saved (a
blank space is a character). Then type DIR (or CHKDSK) and note
the number of free bytes remaining on your hard disk. Is it ten
less than what you had before? No! It is actually an amount equal
to one cluster size less on your system. DOS has eaten a cluster
(2,048 bytes on an AT 286).
So what difference does that make? Well, if you are writing a lot
of short files, like batch files, it could really take available
space away from you. I use a lot of short batch files and find
that there is a way to put most of them in just one file and use
most (or at least more) of a cluster.
The way to do this is to remember that in writing the batch file,
say USE.BAT, you have to write a command line parameter to run
it: thus, for example, to jump right into Word Perfect 5.1, we
could say USE WP if we had a batch file
:USE.BAT cd\%1 %1
that switched to the WP sub-directory and executed the WP Word
Perfect program. What a waste to devote a whole cluster to just
that short file.
Instead consider a batch file whose first line is GOTO sub-%1.
Then add a line of the form :sub-WP, such as :sub-WP Word Perfect
5.1 sub-batch file with remaining additional lines: cd\wp51 wp
goto NOMORE.
Remember that a batch file label starts with a colon (:), so that
:sub-WP represents a label "sub-WP." Typing USE WP tells the
batch file to assign the value WP to the batch file variable %1;
and GOTO sub-%1 says to transfer batch file control to the label
sub-WP once %1 is assigned the value WP.
Typing USE WP with this sub-batch file would run Word Perfect as
before. The added line "goto NOMORE" is included to permit adding
other sub-batch files following :sub-WP. For example, we could
have :sub-123, sub-quicken, sub-qedit, etc. The last line of this
USE.BAT would be just the label :NOMORE.
A lot of space is saved as sub-batch files are accumulated. When
I add a new one to USE.BAT I insert it alphabetically for ease of
reference, and give a brief description of the sub-batch's
purpose on the label line. A sub-batch file can even be written
to show just the sub-batch labels and what they all do.
If you type DIR after creating a few short sub-batch files, you
will be amazed that no more space on the hard disk is used up
than when just using one batch file.
Of course you can forget about space-saving techniques with the
right-size pocketbook: just go out and buy a larger capacity hard
disk or a file compresser. You can always waste resources if you
are willing to pay the price.
Novice SIG Questions
QUESTION: Do I save any space by creating a sub-directory?
ANSWER: No. The purpose of sub-directories is to organize your
files in a way that will simplify your ability to know where
files are. Keeping them in groups of related topics does this.
They will be as well-organized as you make them.
Q: I get an out of space message on my floppy disk when I know
that I have more space there. The DIR listing indicates 112
files.
A: The root directory of a disk drive (floppy or HARD) can only
have a certain maximum number of files. Sub-directories do not
have such a restriction. For 360 kbyte, 5-1/4 inch and 720 kbyte,
3-1/2 inch floppies, the maximum is 112, as you have found out!
For 1.2 Mbyte, 5-1/4 inch and 1.44 Mbyte, 3-1/2 inch drives it is
224; and for the hard disk I have been using it is 512. Since you
can have sub-directories on a floppy, always use a subdirectory
on a floppy to avoid this situation. While using the floppy as
the default drive, type the command MD mydir to create a
subdirectory MYDIR. Then cd\mydir.
Getting Started with Quick Basic
The MS DOS 5.0 command QBASIC can be rather intimidating, as
there is no way of telling what to do with it if you don't
already know some implementation of the BASIC programming
language. A textbook can help quite a bit. There are many around,
but as a starter I suggest Learn Basic Now, by Michael Halvorson
and David Rygmyr, which has a foreword by Bill Gates and is
published by Microsoft Press. Courtesy of Microsoft, copies were
available at one of CPCUG's monthly meetings some months back,
and the book is now carried in some of the local stores.
Typing QBASIC loads the program and guides one into a help file
before one knows what kind of help to seek. Pressing ENTER
results in a blank screen, and then what?
At this point, the full screen editor of DOS 5.0 is available for
your use, if you know enough to benefit from that knowledge. If
not, now is the time to learn. Start typing program instruction
lines, with or without line numbers, your choice.
Use the ALT plus F keys to learn the choices from the resulting
pull-down menu: for saving to a file the lines you create, or for
exiting QBASIC itself. With that menu hanging there, press the
right arrow key to successively pull down other menus. It is
always a good idea before starting to write a program, using
another program such as QBASIC, to know how to create the
programming lines (the source code), how to save what you have
done, how to reload a program previously saved, how to run the
program created in memory, and how to exit the programming
language program itself.