Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
getFile return the number of lines (SOLVED)
#1
Hello,

I am using getFile to load file content to a string. It is also possible to return the number of lines in the file as it loads?

Function Dialog2
Code:
Copy      Help
str fileTxt n
if OpenSaveDialog(0 n "Text files[]*.txt[]Image files[]*.bmp;*.gif[]All Files[]*.*[]")
,fileTxt.getfile(n)
,if string.len(fileTxt)
,out fileTxt

str n a fileTxt
ARRAY(str) arr
int d nt inc
,,if OpenSaveDialog(0 n "Text files[]*.txt[]Image files[]*.bmp;*.gif[]All Files[]*.*[]")
,,,a=fileTxt.getfile(n)
nt = tok(a arr)
for(d 0 nt) 
,inc=inc+1
out F"The number of lines is {inc}"

UPDATE
I managed to solve this using tok. I don't feel it is a very efficient or clean solution but it is working as needed.

Thank you
Matthew


Messages In This Thread
getFile return the number of lines (SOLVED) - by Matthew - 02-25-2020, 11:30 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)