home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 201 / IO1093.ZIP / FTUR05.TXT < prev    next >
Text File  |  1993-09-30  |  6KB  |  134 lines

  1.  
  2.                            By Paul Shapiro
  3.  
  4.  
  5.                              Saving Space
  6.  
  7.   You may be using more hard disk space than you realize!  When you
  8.   look at a DIRectory, you probably think that the number of bytes
  9.   shown for each file is the number of bytes devoted to the file
  10.   shown.  Wrong!  It is just the number of bytes required for the
  11.   substance of the file.  Hard disk space is assigned in clusters.
  12.   A whole cluster is assigned even if only one byte (or character)
  13.   is needed.  But how big is a cluster?  That is easy to find out.
  14.  
  15.   Display your current directory. Write down the number of free
  16.   bytes shown as remaining on your hard disk. If your DIR display
  17.   does not show this, you may get the same information by running
  18.   the CHKDSK utility of DOS.
  19.  
  20.   Then create a short file, SHORT.TXT, by issuing the command echo
  21.   My Monitor >> short.txt.
  22.  
  23.   Then type TYPE SHORT.TEXT to see ten characters just saved (a
  24.   blank space is a character). Then type DIR (or CHKDSK) and note
  25.   the number of free bytes remaining on your hard disk. Is it ten
  26.   less than what you had before? No! It is actually an amount equal
  27.   to one cluster size less on your system. DOS has eaten a cluster
  28.   (2,048 bytes on an AT 286).
  29.  
  30.   So what difference does that make? Well, if you are writing a lot
  31.   of short files, like batch files, it could really take  available
  32.   space away from you. I use a lot of short batch files and find
  33.   that there is a way to put most of them in just one file and use
  34.   most (or at least more) of a cluster.
  35.  
  36.   The way to do this is to remember that in writing the batch file,
  37.   say USE.BAT, you have to write a command line parameter to run
  38.   it: thus, for example, to jump right into Word Perfect 5.1, we
  39.   could say USE WP if we had a batch file
  40.  
  41.   :USE.BAT cd\%1 %1
  42.  
  43.   that switched to the WP sub-directory and executed the WP Word
  44.   Perfect program. What a waste to devote a whole cluster to just
  45.   that short file.
  46.  
  47.   Instead consider a batch file whose first line is GOTO sub-%1.
  48.   Then add a line of the form :sub-WP, such as :sub-WP Word Perfect
  49.   5.1 sub-batch file with remaining additional lines: cd\wp51 wp
  50.   goto NOMORE.
  51.  
  52.   Remember that a batch file label starts with a colon (:), so that
  53.   :sub-WP represents a label "sub-WP." Typing USE WP tells the
  54.   batch file to assign the value WP to the batch file variable %1;
  55.   and GOTO sub-%1 says to transfer batch file control to the label
  56.   sub-WP once %1 is assigned the value WP.
  57.  
  58.   Typing USE WP with this sub-batch file would run Word Perfect as
  59.   before. The added line "goto NOMORE" is included to permit adding
  60.   other sub-batch files following :sub-WP. For example, we could
  61.   have :sub-123, sub-quicken, sub-qedit, etc. The last line of this
  62.   USE.BAT would be just the label :NOMORE.
  63.  
  64.   A lot of space is saved as sub-batch files are accumulated. When
  65.   I add a new one to USE.BAT I insert it alphabetically for ease of
  66.   reference, and give a brief description of the sub-batch's
  67.   purpose on the label line. A sub-batch file can even be written
  68.   to show just the sub-batch labels and what they all do.
  69.  
  70.   If you type DIR after creating a few short sub-batch files, you
  71.   will be amazed that no more space on the hard disk is used up
  72.   than when just using one batch file.
  73.  
  74.   Of course you can forget about space-saving techniques with the
  75.   right-size pocketbook: just go out and buy a larger capacity hard
  76.   disk or a file compresser. You can always waste resources if you
  77.   are willing to pay the price.
  78.  
  79.   Novice SIG Questions
  80.  
  81.   QUESTION: Do I save any space by creating a sub-directory?
  82.  
  83.   ANSWER: No. The purpose of sub-directories is to organize your
  84.   files in a way that will simplify your ability to know where
  85.   files are. Keeping them in groups of related topics does this.
  86.   They will be as well-organized as you make them.
  87.  
  88.   Q: I get an out of space message on my floppy disk when I know
  89.   that I have more space there. The DIR listing indicates 112
  90.   files.
  91.  
  92.   A: The root directory of a disk drive (floppy or HARD) can only
  93.   have a certain maximum number of files. Sub-directories do not
  94.   have such a restriction. For 360 kbyte, 5-1/4 inch and 720 kbyte,
  95.   3-1/2 inch floppies, the maximum is 112, as you have found out!
  96.   For 1.2 Mbyte, 5-1/4 inch and 1.44 Mbyte, 3-1/2 inch drives it is
  97.   224; and for the hard disk I have been using it is 512. Since you
  98.   can have sub-directories on a floppy, always use a subdirectory
  99.   on a floppy to avoid this situation. While using the floppy as
  100.   the default drive, type the command MD mydir to create a
  101.   subdirectory MYDIR. Then cd\mydir.
  102.  
  103.   Getting Started with  Quick Basic
  104.  
  105.   The MS DOS 5.0 command QBASIC can be rather intimidating, as
  106.   there is no way of telling what to do with it if you don't
  107.   already know some implementation of the BASIC programming
  108.   language. A textbook can help quite a bit. There are many around,
  109.   but as a starter I suggest Learn Basic Now, by Michael Halvorson
  110.   and David Rygmyr, which has a foreword by Bill Gates and is
  111.   published by Microsoft Press. Courtesy of Microsoft, copies were
  112.   available at one of CPCUG's monthly meetings some months back,
  113.   and the book is now carried in some of the local stores.
  114.  
  115.   Typing QBASIC loads the program and guides one into a help file
  116.   before one knows what kind of help to seek. Pressing ENTER
  117.   results in a blank screen, and then what?
  118.  
  119.   At this point, the full screen editor of DOS 5.0 is available for
  120.   your use, if you know enough to benefit from that knowledge. If
  121.   not, now is the time to learn. Start typing program instruction
  122.   lines, with or without line numbers, your choice.
  123.  
  124.   Use the ALT plus F keys to learn the choices from the resulting
  125.   pull-down menu: for saving to a file the lines you create, or for
  126.   exiting QBASIC itself. With that menu hanging there, press the
  127.   right arrow key to successively pull down other menus. It is
  128.   always a good idea before starting to write a program, using
  129.   another program such as QBASIC, to know how to create the
  130.   programming lines (the source code), how to save what you have
  131.   done, how to reload a program previously saved, how to run the
  132.   program created in memory, and how to exit the programming
  133.   language program itself.
  134.