I'm reading and reading but I can't find how to manage this problem:
I have a text file that is composed of lines of equal lenght, let's say 100 char plus a CrLf.
If I open the file on a PC, I see something like this:
1234 12:52:00 enter door45 ........ [crlf]
3365 17:59:12 exit door16 ........ [crlf]
Each line, that I call "record", contains some text fields at fixed position, so if I scan the line with a simple Mid$ function it's easy to capture each field.
Question number one: how to open the file and read the record nr 1765 for example ? Do I have to read each line til 1765 ?
Question number two: I have a new record, of course of the same lenght and pattern. I need to open the file and insert this record between record 852 and 853. Also I could need to just get a record, change some fields and write back to the file.
I accomplish this in VB.net creating a record structure, opening the file in openmode.random (specifying the lenght of the records) and working with FileGet and FilePut #recordnumber.
I feel it's easy to do also with B4a but I need some help ...
I have read the RandomAccessFile library and example but can't find the solution.
Thanks
Marco
I have a text file that is composed of lines of equal lenght, let's say 100 char plus a CrLf.
If I open the file on a PC, I see something like this:
1234 12:52:00 enter door45 ........ [crlf]
3365 17:59:12 exit door16 ........ [crlf]
Each line, that I call "record", contains some text fields at fixed position, so if I scan the line with a simple Mid$ function it's easy to capture each field.
Question number one: how to open the file and read the record nr 1765 for example ? Do I have to read each line til 1765 ?
Question number two: I have a new record, of course of the same lenght and pattern. I need to open the file and insert this record between record 852 and 853. Also I could need to just get a record, change some fields and write back to the file.
I accomplish this in VB.net creating a record structure, opening the file in openmode.random (specifying the lenght of the records) and working with FileGet and FilePut #recordnumber.
I feel it's easy to do also with B4a but I need some help ...
I have read the RandomAccessFile library and example but can't find the solution.
Thanks
Marco