Download ACS Color 320 x 240 LCD Basic Programming

Transcript
ACS Color 320 x 240 LCD Basic Programming Manual
8 September 2014
Fixed Length Record File I/O
Here’s a short demonstration of the FOPEN, FREAD and FWRITE commands:
5 DEL "test.dat"
10 FOPEN #1,20,"test.dat"
15 INPUT "how many records:",n
20 FOR r=0 TO n-1
30 FWRITE #1,r,r,"str"+STR$(r)
40 NEXT r
50 PRINT "reading records..."
60 r=0
70 FREAD #1,r,b,b$
75 IF @FEOF(#1) THEN 1000
80 PRINT "rec:",r,"=",b,",",b$
90 r=r+1:GOTO 70
1000 CLOSE #1
Ready
run
how many records:10
reading records...
rec: 0= 0,str0
rec: 1= 1,str1
rec: 2= 2,str2
rec: 3= 3,str3
rec: 4= 4,str4
rec: 5= 5,str5
rec: 6= 6,str6
rec: 7= 7,str7
rec: 8= 8,str8
rec: 9= 9,str9
Ready
type test.dat
0,"str0"
1,"str1"
2,"str2"
3,"str3"
4,"str4"
5,"str5"
6,"str6"
7,"str7"
8,"str8"
9,"str9"
Ready
Copyright©2010-2014 by ACS, Sarasota, Florida
191
ALL RIGHTS RESERVED