D Deleted member 103 Guest Mar 30, 2017 #1 Hi, This code works in B4a without problems. Code: Copy Starter.raf.Initialize(File.DirDocuments, "file.txt", False) Dim lst As List = Starter.raf.ReadB4XObject(Starter.raf.CurrentPosition) Starter.raf.Close In B4i I have to rebuild "raf" the object every time, otherwise it crashes. Code: Copy Dim raf As RandomAccessFile raf.Initialize(File.DirDocuments, "file.txt", False) Dim lst As List = raf.ReadB4XObject(raf.CurrentPosition) raf.Close
Hi, This code works in B4a without problems. Code: Copy Starter.raf.Initialize(File.DirDocuments, "file.txt", False) Dim lst As List = Starter.raf.ReadB4XObject(Starter.raf.CurrentPosition) Starter.raf.Close In B4i I have to rebuild "raf" the object every time, otherwise it crashes. Code: Copy Dim raf As RandomAccessFile raf.Initialize(File.DirDocuments, "file.txt", False) Dim lst As List = raf.ReadB4XObject(raf.CurrentPosition) raf.Close
Erel B4X founder Staff member Licensed User Longtime User Mar 31, 2017 #2 Which error do you get? It is more correct to dim a variable before you initialize it again. There is no reason to use a global variable in this case.
Which error do you get? It is more correct to dim a variable before you initialize it again. There is no reason to use a global variable in this case.
D Deleted member 103 Guest Mar 31, 2017 #3 It is more correct to dim a variable before you initialize it again. There is no reason to use a global variable in this case. Click to expand... So I have no problem, I've only wondered because in B4a, without re-dimensioning the variable, it does not make any problems. Question, after "raf.Initialize" the current position "raf.CurrentPosition" should not be zero?
It is more correct to dim a variable before you initialize it again. There is no reason to use a global variable in this case. Click to expand... So I have no problem, I've only wondered because in B4a, without re-dimensioning the variable, it does not make any problems. Question, after "raf.Initialize" the current position "raf.CurrentPosition" should not be zero?
Erel B4X founder Staff member Licensed User Longtime User Apr 2, 2017 #4 Filippo said: after "raf.Initialize" the current position "raf.CurrentPosition" should not be zero? Click to expand... It is zero.
Filippo said: after "raf.Initialize" the current position "raf.CurrentPosition" should not be zero? Click to expand... It is zero.
D Deleted member 103 Guest Apr 2, 2017 #5 Erel said: It is zero. Click to expand... Unfortunately only with B4a. For B4i, the variable is not zero if the variable "raf" has been defined as a global variable.
Erel said: It is zero. Click to expand... Unfortunately only with B4a. For B4i, the variable is not zero if the variable "raf" has been defined as a global variable.
Erel B4X founder Staff member Licensed User Longtime User Apr 2, 2017 #6 You should call Dim again before you initialize it.
D Deleted member 103 Guest Apr 2, 2017 #7 Erel said: You should call Dim again before you initialize it. Click to expand... Is OK.
Erel B4X founder Staff member Licensed User Longtime User Apr 2, 2017 #8 It is fixed for the next update of iRandomAccessFile.