format
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
format [2018/03/31 13:19] – external edit 127.0.0.1 | format [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 26: | Line 26: | ||
* < | * < | ||
\\ The following code will examine the last four bytes of an open file and determine what format it is:\\ | \\ The following code will examine the last four bytes of an open file and determine what format it is:\\ | ||
+ | <code bb4w> | ||
PTR# | PTR# | ||
type%=0 | type%=0 | ||
Line 34: | Line 35: | ||
IF(!buffer% AND & | IF(!buffer% AND & | ||
IF!buffer%=& | IF!buffer%=& | ||
+ | </ | ||
Here **in%** is the handle of the file that has been opened, **buffer%** is a pointer to a four byte **DIM**ensioned block of memory, **A%** is a temporary variable and on exit **type%** contains the file type.\\ \\ Note that in some circumstances it is legitimate to //append// data to the end of a BBC BASIC program file. In that case this method of determining the format will not work, since the last four bytes of the file will not be the last four bytes of the program. | Here **in%** is the handle of the file that has been opened, **buffer%** is a pointer to a four byte **DIM**ensioned block of memory, **A%** is a temporary variable and on exit **type%** contains the file type.\\ \\ Note that in some circumstances it is legitimate to //append// data to the end of a BBC BASIC program file. In that case this method of determining the format will not work, since the last four bytes of the file will not be the last four bytes of the program. |
format.1522502362.txt.gz · Last modified: 2024/01/05 00:17 (external edit)