|
Post by zzz000abc on Aug 20, 2018 18:04:50 GMT
b$="inkey.bas" b$=readf$(b$) kk=lck(b$) for i=1 to kk c$=word$(b$,i,chr$(10)) if trim$(c$)<>"" then j=j+1:print j,c$ 'skip empty lines 'print i,c$ 'dont skip empty lines next function lck(st$) k=0 while word$(st$,k+1,chr$(10))<>"" k=k+1 wend lck=k end function function readf$(fnam$) open fnam$for binary as #f1 a$="" while eof(#f1)=0 a$=a$+input$(#f1,1) wend 'a$=a$+"EOF "+str$(eof(#f1)) 'print EOF value close #f1 readf$=a$ end function
EDIT: [ code ] tags added
|
|
|
Post by tsh73 on Aug 20, 2018 20:30:08 GMT
Your program works. And that's a good thing. But "readf" part could be made a bit simpler
function readf$(fnam$) open fnam$ for binary as #f1 readf$=input$(#f1,lof(#f1)) close #f1 end function
|
|
|
Post by zzz000abc on Aug 21, 2018 16:40:03 GMT
Your program works. And that's a good thing. But "readf" part could be made a bit simpler function readf$(fnam$) open fnam$ for binary as #f1 readf$=input$(#f1,lof(#f1)) close #f1 end function thank you tsh for simpler function
|
|