AMSTRAD cpc 6128 User Instruction page 102

Integrated computer/disc system
Hide thumbs Also See for cpc 6128:
Table of Contents

Advertisement

Now type this:
b$="TWO"+SPACE$ (17)
c$="THREE"+SPACE$(1S)
IBANKWRITE,@r%,b$,1
IBANKWRITE,@r%,c$
This puts b $ and c $ into records 1 and 2. Again the optional parameter in the first
/ BAN KW R I T E command is used, allowing record 1 to be specified as the record in
which to place b
$.
The current record number is thereafter set to the following
record, so it is unnecessary to specify in which record to put c
$ -
it will be placed in
record 2 automatically.
Type:
PRINT r%
The result of PR IN Ting r % after the above example should be 2. This number can
either be considered as the last record operated on, or as the current record minus one.
In the above example the last record operated on was 2 and the next record will be 3.
The purpose of this 'return code' is to provide information about the operation just
carried out. A successful operation will return a positive number indicating a record
number; an unsuccessful operation will return a negative number indicating an error
code. There are two possible errors that can be returned by /·B A N KW R I T E and
/ BANKREAD. These are:
-1
Indicates that the end of the file has been reached. This happens when all the
records have been used up or a record has been specified that does not exist.
- 3
Indicates a bank switching failure. This should never happen.
Try some further examples:
d$=STRING$(UI,"X")
IBANKOPEN,2~
FOR n=1 to 3: IBANKWRITE,@r%,d$:NEXT
This will set up d $ to contain 20 X's. / BAN KO P EN resets the current record to be 0,
so the / BAN KW R I T E command will overwrite the contents of records 0,1, and 2 with
d$.
Now type:
a$="FIRST"
IBANKWRITE,@r%,a$,~
Foundation Course
Chapter 1 Page 89

Advertisement

Table of Contents
loading

Table of Contents