Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <readFile> '
- rfIdx% = 1 : rfChr% = 0
- open pFileName$, as #1
- for rfW% = 0 to 1 : rfW% = 0
- read #1, rfIdx%; aFile$(pFileName$, rfIdx%) : sleep 0
- rfChr% = rfChr% + len(aFile$(pFileName$, rfIdx%))
- rfIdx% = rfIdx% + 1
- if eof(1) = -1 then rfW% = 1 : rfIdx% = rfIdx% - 1
- next rfW%
- close #1
- aFile$(pFileName$, "len") = str$(rfIdx%)
- aFile$(pFileName$, "chr") = str$(rfIdx% + rfChr%)
- return
- <>
- <readFileTest> '
- pFileName$ = "telehack.txt"
- gosub <readFile>
- for ln% = 1 to aFile$(pFileName$, "len")
- print str$(ln%), aFile$(pFileName$, ln%) : sleep 0
- next ln%
- print "len:", aFile$(pFileName$, "len")
- print "chr:", aFile$(pFileName$, "chr")
- return
- <>
- 800 gosub 909 : end
- 896 '
- 897 rfIdx% = 1 : rfChr% = 0
- 898 open pFileName$, as #1
- 899 for rfW% = 0 to 1 : rfW% = 0
- 900 read #1, rfIdx%; aFile$(pFileName$, rfIdx%) : sleep 0
- 901 rfChr% = rfChr% + len(aFile$(pFileName$, rfIdx%))
- 902 rfIdx% = rfIdx% + 1
- 903 if eof(1) = -1 then rfW% = 1 : rfIdx% = rfIdx% - 1
- 904 next rfW%
- 905 close #1
- 906 aFile$(pFileName$, "len") = str$(rfIdx%)
- 907 aFile$(pFileName$, "chr") = str$(rfIdx% + rfChr%)
- 908 return
- 909 '
- 910 pFileName$ = "telehack.txt"
- 911 gosub 896
- 912 for ln% = 1 to aFile$(pFileName$, "len")
- 913 print str$(ln%), aFile$(pFileName$, ln%) : sleep 0
- 914 next ln%
- 915 print "len:", aFile$(pFileName$, "len")
- 916 print "chr:", aFile$(pFileName$, "chr")
- 917 return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement