Home » Archimedes archive » Acorn User » AU 1993-10.adf » !StarInfo_StarInfo » SharedCLib/FileTest

SharedCLib/FileTest

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1993-10.adf » !StarInfo_StarInfo
Filename: SharedCLib/FileTest
Read OK:
File size: 059A bytes
Load address: 0000
Exec address: 0000
File contents
   10REM     >FileTest
   20REM By  DCA
   30REM For 32-bit machines
   40REM (c) BAU October 1993
   50:
   60MODE 0
   70DIM num% 64,string% 100
   80*RMEnsure SCL 0.20 RMload SCLmod
   90file$="junk"
  100any$="%*[^"+CHR$10+"]"
  110SYS "SCL_fopen",file$,"w" TO handle
  120a=RND(100)
  130b=RND(100)
  140SYS "SCL_fprintf",handle,"%d plus %d equals %d"+CHR$10+CHR$0,a,b,a+b
  150SYS "SCL_fprintf",handle,"A little string: '%s'"+CHR$10+CHR$0,"Acorn User"
  160SYS "SCL_fprintf",handle,"Some formatted numbers:"+CHR$10+CHR$0
  170SYS "SCL_fprintf",handle,"%5d (right justified)"+CHR$10+CHR$0,RND(1000)
  180SYS "SCL_fprintf",handle,"%05d (padded)"+CHR$10+CHR$0,RND(1000)
  190SYS "SCL_fprintf",handle,"%05o (octal)"+CHR$10+CHR$0,RND(1000)
  200SYS "SCL_fprintf",handle,"%05o (hex)"+CHR$10+CHR$0,RND(1000)
  210SYS "SCL_fclose",handle
  220PRINT"File contains:"'
  230OSCLI("TYPE "+file$)
  240PRINT'"Reading values back in..."'
  250SYS "SCL_fopen",file$,"r" TO handle
  260SYS "SCL_fscanf",handle,"%d plus %d equals %d"+CHR$10+CHR$0,num%,num%+4,num%+8 TO no_conv
  270SYS "SCL_fscanf",handle,"A little string: '%[^']'"+CHR$10+CHR$0,string%
  280SYS "SCL_fscanf",handle,any$+CHR$0
  290SYS "SCL_fscanf",handle,"%d "+any$+CHR$0,num%+12
  300SYS "SCL_fscanf",handle,"%d "+any$+CHR$0,num%+16
  310SYS "SCL_fscanf",handle,"%o "+any$+CHR$0,num%+20
  320SYS "SCL_fscanf",handle,"%x "+any$+CHR$0,num%+24
  330SYS "SCL_fclose",handle
  340PRINT"Values read: ";num%!0;",";num%!4;",";num%!8;" (";no_conv;" conversions made)"
  350PRINT"String read: ";
  360SYS "OS_Write0",string%
  370PRINT'"More values: ";num%!12;",";num%!16;",";num%!20;",";num%!24
  380END

�     >FileTest

� By  DCA
� For 32-bit machines
(� (c) BAU October 1993
2:
<� 0
F� num% 64,string% 100
P$*RMEnsure SCL 0.20 RMload SCLmod
Zfile$="junk"
dany$="%*[^"+�10+"]"
n%ș "SCL_fopen",file$,"w" � handle
xa=�(100)
�b=�(100)
�Aș "SCL_fprintf",handle,"%d plus %d equals %d"+�10+�0,a,b,a+b
�Gș "SCL_fprintf",handle,"A little string: '%s'"+�10+�0,"Acorn User"
�<ș "SCL_fprintf",handle,"Some formatted numbers:"+�10+�0
�Bș "SCL_fprintf",handle,"%5d (right justified)"+�10+�0,�(1000)
�:ș "SCL_fprintf",handle,"%05d (padded)"+�10+�0,�(1000)
�9ș "SCL_fprintf",handle,"%05o (octal)"+�10+�0,�(1000)
�7ș "SCL_fprintf",handle,"%05o (hex)"+�10+�0,�(1000)
�ș "SCL_fclose",handle
��"File contains:"'
��("TYPE "+file$)
�"�'"Reading values back in..."'
�%ș "SCL_fopen",file$,"r" � handle
Uș "SCL_fscanf",handle,"%d plus %d equals %d"+�10+�0,num%,num%+4,num%+8 � no_conv
Dș "SCL_fscanf",handle,"A little string: '%[^']'"+�10+�0,string%
"ș "SCL_fscanf",handle,any$+�0
"0ș "SCL_fscanf",handle,"%d "+any$+�0,num%+12
,0ș "SCL_fscanf",handle,"%d "+any$+�0,num%+16
60ș "SCL_fscanf",handle,"%o "+any$+�0,num%+20
@0ș "SCL_fscanf",handle,"%x "+any$+�0,num%+24
Jș "SCL_fclose",handle
TS�"Values read: ";num%!0;",";num%!4;",";num%!8;" (";no_conv;" conversions made)"
^�"String read: ";
hș "OS_Write0",string%
rA�'"More values: ";num%!12;",";num%!16;",";num%!20;",";num%!24
|�
�
00000000  0d 00 0a 13 f4 20 20 20  20 20 3e 46 69 6c 65 54  |.....     >FileT|
00000010  65 73 74 0d 00 14 0d f4  20 42 79 20 20 44 43 41  |est..... By  DCA|
00000020  0d 00 1e 19 f4 20 46 6f  72 20 33 32 2d 62 69 74  |..... For 32-bit|
00000030  20 6d 61 63 68 69 6e 65  73 0d 00 28 1a f4 20 28  | machines..(.. (|
00000040  63 29 20 42 41 55 20 4f  63 74 6f 62 65 72 20 31  |c) BAU October 1|
00000050  39 39 33 0d 00 32 05 3a  0d 00 3c 07 eb 20 30 0d  |993..2.:..<.. 0.|
00000060  00 46 19 de 20 6e 75 6d  25 20 36 34 2c 73 74 72  |.F.. num% 64,str|
00000070  69 6e 67 25 20 31 30 30  0d 00 50 24 2a 52 4d 45  |ing% 100..P$*RME|
00000080  6e 73 75 72 65 20 53 43  4c 20 30 2e 32 30 20 52  |nsure SCL 0.20 R|
00000090  4d 6c 6f 61 64 20 53 43  4c 6d 6f 64 0d 00 5a 10  |Mload SCLmod..Z.|
000000a0  66 69 6c 65 24 3d 22 6a  75 6e 6b 22 0d 00 64 17  |file$="junk"..d.|
000000b0  61 6e 79 24 3d 22 25 2a  5b 5e 22 2b bd 31 30 2b  |any$="%*[^"+.10+|
000000c0  22 5d 22 0d 00 6e 25 c8  99 20 22 53 43 4c 5f 66  |"]"..n%.. "SCL_f|
000000d0  6f 70 65 6e 22 2c 66 69  6c 65 24 2c 22 77 22 20  |open",file$,"w" |
000000e0  b8 20 68 61 6e 64 6c 65  0d 00 78 0c 61 3d b3 28  |. handle..x.a=.(|
000000f0  31 30 30 29 0d 00 82 0c  62 3d b3 28 31 30 30 29  |100)....b=.(100)|
00000100  0d 00 8c 41 c8 99 20 22  53 43 4c 5f 66 70 72 69  |...A.. "SCL_fpri|
00000110  6e 74 66 22 2c 68 61 6e  64 6c 65 2c 22 25 64 20  |ntf",handle,"%d |
00000120  70 6c 75 73 20 25 64 20  65 71 75 61 6c 73 20 25  |plus %d equals %|
00000130  64 22 2b bd 31 30 2b bd  30 2c 61 2c 62 2c 61 2b  |d"+.10+.0,a,b,a+|
00000140  62 0d 00 96 47 c8 99 20  22 53 43 4c 5f 66 70 72  |b...G.. "SCL_fpr|
00000150  69 6e 74 66 22 2c 68 61  6e 64 6c 65 2c 22 41 20  |intf",handle,"A |
00000160  6c 69 74 74 6c 65 20 73  74 72 69 6e 67 3a 20 27  |little string: '|
00000170  25 73 27 22 2b bd 31 30  2b bd 30 2c 22 41 63 6f  |%s'"+.10+.0,"Aco|
00000180  72 6e 20 55 73 65 72 22  0d 00 a0 3c c8 99 20 22  |rn User"...<.. "|
00000190  53 43 4c 5f 66 70 72 69  6e 74 66 22 2c 68 61 6e  |SCL_fprintf",han|
000001a0  64 6c 65 2c 22 53 6f 6d  65 20 66 6f 72 6d 61 74  |dle,"Some format|
000001b0  74 65 64 20 6e 75 6d 62  65 72 73 3a 22 2b bd 31  |ted numbers:"+.1|
000001c0  30 2b bd 30 0d 00 aa 42  c8 99 20 22 53 43 4c 5f  |0+.0...B.. "SCL_|
000001d0  66 70 72 69 6e 74 66 22  2c 68 61 6e 64 6c 65 2c  |fprintf",handle,|
000001e0  22 25 35 64 20 28 72 69  67 68 74 20 6a 75 73 74  |"%5d (right just|
000001f0  69 66 69 65 64 29 22 2b  bd 31 30 2b bd 30 2c b3  |ified)"+.10+.0,.|
00000200  28 31 30 30 30 29 0d 00  b4 3a c8 99 20 22 53 43  |(1000)...:.. "SC|
00000210  4c 5f 66 70 72 69 6e 74  66 22 2c 68 61 6e 64 6c  |L_fprintf",handl|
00000220  65 2c 22 25 30 35 64 20  28 70 61 64 64 65 64 29  |e,"%05d (padded)|
00000230  22 2b bd 31 30 2b bd 30  2c b3 28 31 30 30 30 29  |"+.10+.0,.(1000)|
00000240  0d 00 be 39 c8 99 20 22  53 43 4c 5f 66 70 72 69  |...9.. "SCL_fpri|
00000250  6e 74 66 22 2c 68 61 6e  64 6c 65 2c 22 25 30 35  |ntf",handle,"%05|
00000260  6f 20 28 6f 63 74 61 6c  29 22 2b bd 31 30 2b bd  |o (octal)"+.10+.|
00000270  30 2c b3 28 31 30 30 30  29 0d 00 c8 37 c8 99 20  |0,.(1000)...7.. |
00000280  22 53 43 4c 5f 66 70 72  69 6e 74 66 22 2c 68 61  |"SCL_fprintf",ha|
00000290  6e 64 6c 65 2c 22 25 30  35 6f 20 28 68 65 78 29  |ndle,"%05o (hex)|
000002a0  22 2b bd 31 30 2b bd 30  2c b3 28 31 30 30 30 29  |"+.10+.0,.(1000)|
000002b0  0d 00 d2 1a c8 99 20 22  53 43 4c 5f 66 63 6c 6f  |...... "SCL_fclo|
000002c0  73 65 22 2c 68 61 6e 64  6c 65 0d 00 dc 16 f1 22  |se",handle....."|
000002d0  46 69 6c 65 20 63 6f 6e  74 61 69 6e 73 3a 22 27  |File contains:"'|
000002e0  0d 00 e6 14 ff 28 22 54  59 50 45 20 22 2b 66 69  |.....("TYPE "+fi|
000002f0  6c 65 24 29 0d 00 f0 22  f1 27 22 52 65 61 64 69  |le$)...".'"Readi|
00000300  6e 67 20 76 61 6c 75 65  73 20 62 61 63 6b 20 69  |ng values back i|
00000310  6e 2e 2e 2e 22 27 0d 00  fa 25 c8 99 20 22 53 43  |n..."'...%.. "SC|
00000320  4c 5f 66 6f 70 65 6e 22  2c 66 69 6c 65 24 2c 22  |L_fopen",file$,"|
00000330  72 22 20 b8 20 68 61 6e  64 6c 65 0d 01 04 55 c8  |r" . handle...U.|
00000340  99 20 22 53 43 4c 5f 66  73 63 61 6e 66 22 2c 68  |. "SCL_fscanf",h|
00000350  61 6e 64 6c 65 2c 22 25  64 20 70 6c 75 73 20 25  |andle,"%d plus %|
00000360  64 20 65 71 75 61 6c 73  20 25 64 22 2b bd 31 30  |d equals %d"+.10|
00000370  2b bd 30 2c 6e 75 6d 25  2c 6e 75 6d 25 2b 34 2c  |+.0,num%,num%+4,|
00000380  6e 75 6d 25 2b 38 20 b8  20 6e 6f 5f 63 6f 6e 76  |num%+8 . no_conv|
00000390  0d 01 0e 44 c8 99 20 22  53 43 4c 5f 66 73 63 61  |...D.. "SCL_fsca|
000003a0  6e 66 22 2c 68 61 6e 64  6c 65 2c 22 41 20 6c 69  |nf",handle,"A li|
000003b0  74 74 6c 65 20 73 74 72  69 6e 67 3a 20 27 25 5b  |ttle string: '%[|
000003c0  5e 27 5d 27 22 2b bd 31  30 2b bd 30 2c 73 74 72  |^']'"+.10+.0,str|
000003d0  69 6e 67 25 0d 01 18 22  c8 99 20 22 53 43 4c 5f  |ing%...".. "SCL_|
000003e0  66 73 63 61 6e 66 22 2c  68 61 6e 64 6c 65 2c 61  |fscanf",handle,a|
000003f0  6e 79 24 2b bd 30 0d 01  22 30 c8 99 20 22 53 43  |ny$+.0.."0.. "SC|
00000400  4c 5f 66 73 63 61 6e 66  22 2c 68 61 6e 64 6c 65  |L_fscanf",handle|
00000410  2c 22 25 64 20 22 2b 61  6e 79 24 2b bd 30 2c 6e  |,"%d "+any$+.0,n|
00000420  75 6d 25 2b 31 32 0d 01  2c 30 c8 99 20 22 53 43  |um%+12..,0.. "SC|
00000430  4c 5f 66 73 63 61 6e 66  22 2c 68 61 6e 64 6c 65  |L_fscanf",handle|
00000440  2c 22 25 64 20 22 2b 61  6e 79 24 2b bd 30 2c 6e  |,"%d "+any$+.0,n|
00000450  75 6d 25 2b 31 36 0d 01  36 30 c8 99 20 22 53 43  |um%+16..60.. "SC|
00000460  4c 5f 66 73 63 61 6e 66  22 2c 68 61 6e 64 6c 65  |L_fscanf",handle|
00000470  2c 22 25 6f 20 22 2b 61  6e 79 24 2b bd 30 2c 6e  |,"%o "+any$+.0,n|
00000480  75 6d 25 2b 32 30 0d 01  40 30 c8 99 20 22 53 43  |um%+20..@0.. "SC|
00000490  4c 5f 66 73 63 61 6e 66  22 2c 68 61 6e 64 6c 65  |L_fscanf",handle|
000004a0  2c 22 25 78 20 22 2b 61  6e 79 24 2b bd 30 2c 6e  |,"%x "+any$+.0,n|
000004b0  75 6d 25 2b 32 34 0d 01  4a 1a c8 99 20 22 53 43  |um%+24..J... "SC|
000004c0  4c 5f 66 63 6c 6f 73 65  22 2c 68 61 6e 64 6c 65  |L_fclose",handle|
000004d0  0d 01 54 53 f1 22 56 61  6c 75 65 73 20 72 65 61  |..TS."Values rea|
000004e0  64 3a 20 22 3b 6e 75 6d  25 21 30 3b 22 2c 22 3b  |d: ";num%!0;",";|
000004f0  6e 75 6d 25 21 34 3b 22  2c 22 3b 6e 75 6d 25 21  |num%!4;",";num%!|
00000500  38 3b 22 20 28 22 3b 6e  6f 5f 63 6f 6e 76 3b 22  |8;" (";no_conv;"|
00000510  20 63 6f 6e 76 65 72 73  69 6f 6e 73 20 6d 61 64  | conversions mad|
00000520  65 29 22 0d 01 5e 15 f1  22 53 74 72 69 6e 67 20  |e)"..^.."String |
00000530  72 65 61 64 3a 20 22 3b  0d 01 68 1a c8 99 20 22  |read: ";..h... "|
00000540  4f 53 5f 57 72 69 74 65  30 22 2c 73 74 72 69 6e  |OS_Write0",strin|
00000550  67 25 0d 01 72 41 f1 27  22 4d 6f 72 65 20 76 61  |g%..rA.'"More va|
00000560  6c 75 65 73 3a 20 22 3b  6e 75 6d 25 21 31 32 3b  |lues: ";num%!12;|
00000570  22 2c 22 3b 6e 75 6d 25  21 31 36 3b 22 2c 22 3b  |",";num%!16;",";|
00000580  6e 75 6d 25 21 32 30 3b  22 2c 22 3b 6e 75 6d 25  |num%!20;",";num%|
00000590  21 32 34 0d 01 7c 05 e0  0d ff                    |!24..|....|
0000059a