Advertisement
Searinox

Untitled

Jul 19th, 2020
2,457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <readFile> '
  2.     rfIdx% = 1 : rfChr% = 0
  3.     open pFileName$, as #1
  4.     for rfW% = 0 to 1 : rfW% = 0
  5.         read #1, rfIdx%; aFile$(pFileName$, rfIdx%) : sleep 0
  6.         rfChr% = rfChr% + len(aFile$(pFileName$, rfIdx%))
  7.         rfIdx% = rfIdx% + 1
  8.         if eof(1) = -1 then rfW% = 1 : rfIdx% = rfIdx% - 1
  9.     next rfW%
  10.     close #1
  11.     aFile$(pFileName$, "len") = str$(rfIdx%)
  12.     aFile$(pFileName$, "chr") = str$(rfIdx% + rfChr%)
  13.     return
  14. <>
  15.  
  16. <readFileTest> '
  17.     pFileName$ = "telehack.txt"
  18.     gosub <readFile>
  19.     for ln% = 1 to aFile$(pFileName$, "len")
  20.         print str$(ln%), aFile$(pFileName$, ln%) : sleep 0
  21.     next ln%
  22.     print "len:", aFile$(pFileName$, "len")
  23.     print "chr:", aFile$(pFileName$, "chr")
  24.     return
  25. <>
  26.  
  27.  
  28.   800  gosub 909 : end
  29.   896  '
  30.   897  rfIdx% = 1 : rfChr% = 0
  31.   898  open pFileName$, as #1
  32.   899  for rfW% = 0 to 1 : rfW% = 0
  33.   900  read #1, rfIdx%; aFile$(pFileName$, rfIdx%) : sleep 0
  34.   901  rfChr% = rfChr% + len(aFile$(pFileName$, rfIdx%))
  35.   902  rfIdx% = rfIdx% + 1
  36.   903  if eof(1) = -1 then rfW% = 1 : rfIdx% = rfIdx% - 1
  37.   904  next rfW%
  38.   905  close #1
  39.   906  aFile$(pFileName$, "len") = str$(rfIdx%)
  40.   907  aFile$(pFileName$, "chr") = str$(rfIdx% + rfChr%)
  41.   908  return
  42.   909  '
  43.   910  pFileName$ = "telehack.txt"
  44.   911  gosub 896
  45.   912  for ln% = 1 to aFile$(pFileName$, "len")
  46.   913  print str$(ln%), aFile$(pFileName$, ln%) : sleep 0
  47.   914  next ln%
  48.   915  print "len:", aFile$(pFileName$, "len")
  49.   916  print "chr:", aFile$(pFileName$, "chr")
  50.   917  return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement