I have a problem with LibreOffice Basic Macro. Its seems just stupid. I have a random file a small part of the record is a 2 Byte Integer stored as a 2 Byte string (Mki$). It’s Value is only ever 0 or -1. When -1 it is found in other parts of the programme as 16,129. I set a trap to see where it changes. I added a Print immediately after the Put statement checking data with the variable just used. All ok. Then I added a Get record straight after using the same Variable. It had changed to 16,129 again. Only -1 was effected all other numbers worked well. Last step to prove it was not the Mki$. I wrote the actual Bytes into the Variable. I put Chr(128) & Chr(1), which is how Mki$ should have stored into the variable. It changed it again always to the same number.
Print statement produced
-1 128 1 -1
-1 63 1 16129
Please Help Code Follows
.Status = -1
Field =Mki$(.No) & Mki$(.Strength) & Mki$(.Status) & .All & .Game & CrLf
Put #b,.No,Field
Print .Status, asc(mid(Field,5,1)), asc(mid(Field,6,1)),Cvi(mid(Field,5,2))
Get #b,.No,Field
Print .Status, asc(mid(Field,5,1)), asc(mid(Field,6,1)),Cvi(mid(Field,5,2))
Before someone moans I had to add the BASE Tag or else I could not post it.