Add files via upload

This commit is contained in:
Андрей 2021-03-29 20:43:07 +04:00 committed by GitHub
parent 64c6352265
commit 35131ba393
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
90 changed files with 1738 additions and 0 deletions

Binary file not shown.

View file

@ -0,0 +1,41 @@
SUB MAIN
DIM bool AS BOOLEAN
DIM b AS BYTE
DIM w AS SHORT
DIM i AS INTEGER
DIM l AS LONG
DIM f AS FLOAT
DIM d AS DOUBLE
DIM s AS STRING
DIM c AS COMPLEX
PRINT "Writing file"
OPEN #1,"fileio.dat","w"
PUT #1,true
PUT #1,BYTE(45)
PUT #1,SHORT(768)
PUT #1,123
CLOSE #1
PRINT "Appending to file"
OPEN #1,"fileio.dat","a"
PUT #1,9876l
PUT #1,"hello"
PUT #1,COMPLEX(3.1,-2.5)
PUT #1,3.1f
PUT #1,pi
CLOSE #1
PRINT "Reading file"
OPEN #1,"fileio.dat","r"
GET #1,bool,b,w,i,l
GET #1,s
GET #1,c,f,d
CLOSE #1
PRINT bool
PRINT b,w,i,l
PRINT s
PRINT c
PRINT f,d
END SUB

BIN
Examples/FileIO/fileio.dat Normal file

Binary file not shown.

View file

@ -0,0 +1,51 @@
SUB MAIN()
DIM TM AS DOUBLE
DIM DD,MM,CCYY AS INTEGER
DIM HRS,MINS,SECS,MILLI AS INTEGER
DIM S AS STRING
DIM DATAFILE AS STRING
DATAFILE = "appendfile.dat"
TM=NOW()
DD=DAY(TM)
MM=MONTH(TM)
CCYY=YEAR(TM)
HRS=HOUR(TM)
MINS=MINUTE(TM)
SECS=SECOND(TM)
MILLI=MILLISECOND(TM)
S=STR$(DD) + "/" + STR$(MM) + "/" + STR$(CCYY) + " " + STR$(HRS) + ":" + STR$(MINS) + ":" + STR$(SECS) + "." + STR$(MILLI)
REM
REM ================================
REM Append Current Time to data file
REM ================================
REM
PRINT "Appending: " + S
OPEN #1,DATAFILE,"a"
PUT #1,S
CLOSE #1
REM
REM =================================================
REM Read back and display all times in appendfile.dat
REM =================================================
REM
PRINT "List of times in " + CHR$(0x22) + "appendfile.dat" + CHR$(0x22)
OPEN #1,DATAFILE,"r"
TRY
WHILE (TRUE)
GET #1,S
PRINT S
END WHILE
CATCH S
PRINT "End of File"
END TRY
CLOSE #1
END SUB