September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,20 +1,24 @@
100 I$ = "INPUT.TXT"
110 O$ = "OUTPUT.TXT"
120 D$ = CHR$(4)
130 M$ = CHR$(13)
120 M$ = CHR$(13)
130 D$ = CHR$(4)
140 PRINT D$"VERIFY"I$
150 PRINT D$"OPEN"O$M$D$"CLOSE"O$M$D$"DELETE"O$
160 PRINT D$"OPEN"O$M$D$"OPEN"I$;
150 PRINT D$"OPEN"O$
160 PRINT D$"DELETE"O$
170 PRINT D$"OPEN"O$
180 PRINT D$"OPEN"I$
170 PRINT M$D$"READ"I$
180 ONERR GOTO 250
190 GET C$
200 POKE 216,0
210 PRINT M$D$"WRITE"O$",B"B
220 IF C$ <> M$ THEN PRINT C$;
230 B = B + 1
240 GOTO 170
190 PRINT D$"READ"I$
200 ONERR GOTO 280
210 GET C$
220 POKE 216,0
230 PRINT M$D$"WRITE"O$",B"B
240 B = B + 1
250 P = 2 - (C$ <> M$)
260 PRINT MID$(C$, P)
270 GOTO 190
250 POKE 216,0
260 IF PEEK(222) <> 5 THEN RESUME
270 PRINT M$D$"CLOSE"I$M$D$"CLOSE"O$
280 POKE 216,0
290 EOF = PEEK(222) = 5
300 IF NOT EOF THEN RESUME
310 PRINT M$D$"CLOSE"

View file

@ -0,0 +1,13 @@
10 print chr$(14) : rem switch to upper+lower case set
20 print "read seq file input.txt and write to seq file output.txt"
30 open 4,8,4,"input.txt,seq,read"
40 open 8,8,8,"@:output.txt,seq,write" : rem '@'== new file
50 for i=0 to 1 : rem while i==0
60 input#4,a$
70 i=64 and st : rem check bit 6=='end of file'
80 print a$
90 print#8,a$
100 next : rem end while
110 close 4
120 close 8
130 end

View file

@ -0,0 +1,11 @@
Public Sub Main()
Dim sOutput As String = "Hello "
Dim sInput As String = File.Load(User.Home &/ "input.txt") 'Has the word 'World!' stored
File.Save(User.Home &/ "output.txt", sOutput)
File.Save(User.Home &/ "input.txt", sOutput & sInput)
Print "'input.txt' contains - " & sOutput & sInput
Print "'output.txt' contains - " & sOutput
End

View file

@ -0,0 +1,8 @@
// version 1.1.2
import java.io.File
fun main(args: Array<String>) {
val text = File("input.txt").readText()
File("output.txt").writeText(text)
}

View file

@ -0,0 +1,4 @@
alias Write2FileAndReadIt {
.write myfilename.txt Goodbye Mike!
.echo -a Myfilename.txt contains: $read(myfilename.txt,1)
}

View file

@ -0,0 +1,5 @@
inout:=proc(filename)
local f;
f:=FileTools[Text][ReadFile](filename);
FileTools[Text][WriteFile]("output.txt",f);
end proc;

View file

@ -1,10 +1,12 @@
/*REXX program to read a file and store the contents into an output file*/
iFID = 'input.txt' /*name of the input file. */
oFID = 'output.txt' /*name of the output file. */
call lineout oFID,,1 /*insure output starts at line 1.*/
/*REXX program reads a file and copies the contents into an output file (on a line by line basis).*/
iFID = 'input.txt' /*the name of the input file. */
oFID = 'output.txt' /* " " " " output " */
call lineout iFID,,1 /*insure the input starts at line one.*/ /* ◄■■■■■■ optional.*/
call lineout oFID,,1 /* " " output " " " " */ /* ◄■■■■■■ optional.*/
do while lines(iFID)\==0 /*read records until finished. */
y = linein(iFID) /*read a record from input. */
call lineout oFID,y /*write a record to output. */
end /*while ···*/
/*stick a fork in it, we're done.*/
do while lines(iFID)\==0; $=linein(iFID) /*read records from input 'til finished*/
call lineout oFID, $ /*write the record just read ──► output*/
end /*while*/ /*stick a fork in it, we're all done. */
call lineout iFID /*close input file, just to be safe.*/ /* ◄■■■■■■ best programming practice.*/
call lineout oFID /* " output " " " " " */ /* ◄■■■■■■ best programming practice.*/

View file

@ -0,0 +1,14 @@
program copyfile
file open fin using `1', read text
file open fout using `2', write text replace
file read fin line
while !r(eof) {
file write fout `"`line'"' _newline
file read fin line
}
file close fin
file close fout
end
copyfile input.txt output.txt

View file

@ -0,0 +1,10 @@
$$ MODE TUSCRIPT
ERROR/STOP CREATE ("input.txt", seq-o,-std-)
ERROR/STOP CREATE ("output.txt",seq-o,-std-)
FILE/ERASE "input.txt" = "Some irrelevant content"
path2input =FULLNAME(TUSTEP,"input.txt", -std-)
status=READ (path2input,contentinput)
path2output=FULLNAME(TUSTEP,"output.txt",-std-)
status=WRITE(path2output,contentinput)

View file

@ -0,0 +1,2 @@
(let ((var (file-get-string "input.txt")))
(file-put-string "output.txt" var))

View file

@ -0,0 +1,2 @@
(let ((var (file-get-lines "input.txt")))
(file-put-lines "output.txt" var))

View file

@ -0,0 +1,3 @@
var d=File("input.txt").read();
(f:=File("output.txt","w")).write(d); f.close(); // one read, one write copy
File("output.txt").pump(Console); // verify by printing

View file

@ -0,0 +1,3 @@
var in=File("input.txt"), out=File("output.txt","w");
foreach line in (in) { out.write(line) } // copy line by line
out.close(); // or out=Void and let GC close the file

View file

@ -0,0 +1,2 @@
fin,fout:=File("input.txt","rb"), File("output.txt","wb"); // copy in chunks, implicit buffer
fin.pump(Data(0d524_287),fout); fin.close(); fout.close();

View file

@ -0,0 +1,2 @@
// copy in chunks, let GC close file handles
File("input.txt","rb").pump(Data(0d524_287),File("output.txt","wb"));

View file

@ -0,0 +1 @@
File("input.txt").pump(Data(),File("output.txt","w"),"text","toUpper");