Hi Charles,
I had this little file-reading program that uses parseutil.inc. It used to give me the values correctly, but now it doesn't. Has something changed?
Could you please help me?
uses parseutil
new Textarray t
t.load "dati.txt"
print t.line 7
string a=t.line 7
print t.lineCount
del t
wait
Hi Nicola,
I've checked line read and write. It looks okay.
'06/02/2026
uses parseutil
uses console
Textarray t
t.load "t.txt"
int i
t.line(2)="ok"
for i=1 to 20
string a=t.line i
print i tab a cr
next
print cr cr t.lineCount
wait
del t
PS: found problem with 64bit ! I'm checking ...
Something is wrong...
I tried my sample and yours... yours (photo 1) is fine, mine isn't (photo 2).
I can't figure out why.
The number of lines doesn't seem real to me either
'06/02/2026 - charles
uses parseutil
uses console
Textarray t
t.load "dati.txt"
int i
t.line(2)="ok"
for i=1 to 20
string a=t.line i
print i tab a cr
next
print cr cr t.lineCount
wait
del t
'nico
uses parseutil
uses console
print "prova Nicola"
textarray t
t.load "dati.txt"
string a=t.line 2
print a
a=t.line 7
print cr cr t.lineCount
print "finito"
wait
del t
I am testing it on a 64-bit system :-[
Hi Charles, have you done any checks?
I can't understand why this happens.
Cheers
Hi Nicola,
I think I've fixed the problem. Could you try this attached version of inc/stringutil.inc
updated later
So, I did various tests with very strange results. Then I copied your little program into another oxide window and strangely it gave me anomalous results. I saved this second file with a different name, tried it and it was fine. So I tried to do the same thing with my little program: this time it worked well. I did other similar tests... in the end I realized that making some changes and starting with F5 didn't give the desired results. So, I saved the file with SAVE (ctrl-s), and started with F5 and the results were correct... I did other tests and every time I didn't save first with ctrl-s the results were not the ones I wanted...
An oxide problem or do I need to save before starting the program every time?
That seems tobe a different problem. Oxide normally saves the source code before compile/execute [F5]. If there is no file name, it automatically saves to a temporary file "_", so it can compile/execute it.
I have found that placing uses console after uses parseutil causes problems in 64bit.
correct order:
'uses RTL64
uses console
uses parseutil
...
Also another update for inc/stringutil.inc below
Unfortunately the situation does not seem to have improved, on the contrary.
I noticed that since you put it as a macro, PRINTL no longer works correctly.
'function print(string s="") 'override
'====================================
'output s
'end function
'function printl(string s="")
'===========================
'output s cr
'end function
macro print(s="") output s
macro printl(s="") output s cr
I've run a number of tests and found that these macros fail when functions are used without brackets.
The parsing fails. I hope this helps.
for instance:
uses console
printl left(text",3) 'works
output left "text",3 'works
printl left "text",3 'fails
Better behaviour can be achieved by using polymorphic functions:
Function output(string bufout)
==============================
static long buflen,bufrit
buflen=len bufout
WriteFile ConsOut,strptr bufout,buflen,@bufrit,null
End Function
'
Function print(string bufout)
=============================
static long buflen,bufrit
buflen=len bufout
WriteFile ConsOut,strptr bufout,buflen,@bufrit,null
End Function
'
Function printl(string s)
=========================
static long buflen,bufrit
string bufout=s+cr
buflen=len bufout
WriteFile ConsOut,strptr bufout,buflen,@bufrit,null
End Function
Function printl()
=================
print cr
end function
Function print()
================
print ""
end function
Adopted in this version of inc/console.inc