
Ron's Week'n'ADAM

      February 16, 1998


      I've been looking at the business of using SmartBASIC to
read from and write to a disk. Actually, I've been using Smart-
BASIC1.x. It ties in with something I want to do later, but I 
have to get the fundamentals straight first. Right at the moment,
I don't know much about it, but I'm beginning to learn a thing 
or two.

     Under SmartBASIC, writing to or reading from most things 
(keyboards, printers, disk drives, video displays) is accomp-
lished with the <PRINT> statement and the <INPUT> or <GET>
statements. If you're sending something out somewhere, you can 
under certain circumstances use the former, and to get something 
from somewhere, you can use the latter two. If you think of a 
railway track switch directing a train from a mainline to a 
branch line, you might get a better picture of how I/O, or 
input/output is handled by BASIC.

      Let's try something. Consider the following program.

      0REM
-------------------------------------------------------
      10REM The following program gets a string input from the
      20REM keyboard by the user, and writes it to the default
      30REM storage media.
      40REM -------------------------------------------------
      50REM -------------------------------------------------
      100HOME
      110? "Watch what you say, it's being recorded!"
      120?
      130? "Enter a sentence. No commas please - I hate commas."
      135?:?
      150REM We'll explain the commas later
      160REM 170 d$=CHR$(13)+CHR$(4)
      180? "Ok, say something but keep it short. "
      185?:INPUT stuff$
      190?
      200REM---------------------------------------------------
      210REM---------------------------------------------------
      230REM beginning of disk save routine
      240? d$;"open phyle"
      250? d$;"write phyle"
      260? stuff$
      270? d$;"close phyle"
      280REM t d$; "close phyle"
      290REM 295?:? "Done. "
      298REM End of program
      299END
      65535REM disk write demo by Ron Mitchell. Feb 16, 1998

      How do you know that your string actually got written to
disk?  Well, at this point you don't. We'll get to that and some
other  more sophisticated bells and whistles over the next few
weeks. 

      Meantime, try this. do a CATALOG to see if the file "phyle"
      actually made it to disk. If it did, get out of BASIC, load
      up your FileManager or JKL Utilities, and see whether or not
      you can actually read the string that was written to disk. 
      Your "Edit Block" function ought to do it for you.

      More next week


      Ron Mitchell

