Home » Archimedes archive » Acorn User » AU 1994-06.adf » !BasicProg_BasicProg » Listing2

Listing2

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 1994-06.adf » !BasicProg_BasicProg
Filename: Listing2
Read OK:
File size: 01D8 bytes
Load address: 0000
Exec address: 0000
File contents
    1REM >Listing2
    2REM This program will copy a text file, numbering the lines
    3:
    4ON ERROR REPORT: PRINT " at line ";ERL:END
    5filein$ = "<BackToBasics$Dir>.File2"
    6fileout$ = "<BackToBasics$Dir>.File3"
    7handlein% = OPENIN(filein$)
    8IF handlein% = 0 THEN PRINT "File ";file$;" not found.": END
    9handleout% = OPENOUT(fileout$)
   10i%=0
   11WHILE NOT EOF#handlein%
   12 INPUT#handlein%,in$
   13 PRINT#handleout%,i%,in$
   14 i% += 1
   15ENDWHILE
   16CLOSE#handlein%
   17CLOSE#handleout%
   18*SETTYPE "<BackToBasics$Dir>.File3" TEXT
   19END   
� >Listing2
=� This program will copy a text file, numbering the lines
:
� � �: � " at line ";�:�
(filein$ = "<BackToBasics$Dir>.File2"
)fileout$ = "<BackToBasics$Dir>.File3"
handlein% = �(filein$)
6� handlein% = 0 � � "File ";file$;" not found.": �
	handleout% = �(fileout$)

i%=0
ȕ � �#handlein%
 �#handlein%,in$

 �#handleout%,i%,in$
 i% += 1
�
�#handlein%
�#handleout%
,*SETTYPE "<BackToBasics$Dir>.File3" TEXT
�   
�
00000000  0d 00 01 0f f4 20 3e 4c  69 73 74 69 6e 67 32 0d  |..... >Listing2.|
00000010  00 02 3d f4 20 54 68 69  73 20 70 72 6f 67 72 61  |..=. This progra|
00000020  6d 20 77 69 6c 6c 20 63  6f 70 79 20 61 20 74 65  |m will copy a te|
00000030  78 74 20 66 69 6c 65 2c  20 6e 75 6d 62 65 72 69  |xt file, numberi|
00000040  6e 67 20 74 68 65 20 6c  69 6e 65 73 0d 00 03 05  |ng the lines....|
00000050  3a 0d 00 04 1c ee 20 85  20 f6 3a 20 f1 20 22 20  |:..... . .: . " |
00000060  61 74 20 6c 69 6e 65 20  22 3b 9e 3a e0 0d 00 05  |at line ";.:....|
00000070  28 66 69 6c 65 69 6e 24  20 3d 20 22 3c 42 61 63  |(filein$ = "<Bac|
00000080  6b 54 6f 42 61 73 69 63  73 24 44 69 72 3e 2e 46  |kToBasics$Dir>.F|
00000090  69 6c 65 32 22 0d 00 06  29 66 69 6c 65 6f 75 74  |ile2"...)fileout|
000000a0  24 20 3d 20 22 3c 42 61  63 6b 54 6f 42 61 73 69  |$ = "<BackToBasi|
000000b0  63 73 24 44 69 72 3e 2e  46 69 6c 65 33 22 0d 00  |cs$Dir>.File3"..|
000000c0  07 1a 68 61 6e 64 6c 65  69 6e 25 20 3d 20 8e 28  |..handlein% = .(|
000000d0  66 69 6c 65 69 6e 24 29  0d 00 08 36 e7 20 68 61  |filein$)...6. ha|
000000e0  6e 64 6c 65 69 6e 25 20  3d 20 30 20 8c 20 f1 20  |ndlein% = 0 . . |
000000f0  22 46 69 6c 65 20 22 3b  66 69 6c 65 24 3b 22 20  |"File ";file$;" |
00000100  6e 6f 74 20 66 6f 75 6e  64 2e 22 3a 20 e0 0d 00  |not found.": ...|
00000110  09 1c 68 61 6e 64 6c 65  6f 75 74 25 20 3d 20 ae  |..handleout% = .|
00000120  28 66 69 6c 65 6f 75 74  24 29 0d 00 0a 08 69 25  |(fileout$)....i%|
00000130  3d 30 0d 00 0b 14 c8 95  20 ac 20 c5 23 68 61 6e  |=0...... . .#han|
00000140  64 6c 65 69 6e 25 0d 00  0c 14 20 e8 23 68 61 6e  |dlein%.... .#han|
00000150  64 6c 65 69 6e 25 2c 69  6e 24 0d 00 0d 18 20 f1  |dlein%,in$.... .|
00000160  23 68 61 6e 64 6c 65 6f  75 74 25 2c 69 25 2c 69  |#handleout%,i%,i|
00000170  6e 24 0d 00 0e 0c 20 69  25 20 2b 3d 20 31 0d 00  |n$.... i% += 1..|
00000180  0f 05 ce 0d 00 10 0f d9  23 68 61 6e 64 6c 65 69  |........#handlei|
00000190  6e 25 0d 00 11 10 d9 23  68 61 6e 64 6c 65 6f 75  |n%.....#handleou|
000001a0  74 25 0d 00 12 2c 2a 53  45 54 54 59 50 45 20 22  |t%...,*SETTYPE "|
000001b0  3c 42 61 63 6b 54 6f 42  61 73 69 63 73 24 44 69  |<BackToBasics$Di|
000001c0  72 3e 2e 46 69 6c 65 33  22 20 54 45 58 54 0d 00  |r>.File3" TEXT..|
000001d0  13 08 e0 20 20 20 0d ff                           |...   ..|
000001d8