Menu

#673 RANDOM file I/O incompatibility with QB

open
nobody
None
rtlib
2013-05-20
2013-05-20
Matthew
No

In QB, Random file I/O supports two things we don't:
- the data size can be less than the record length (in this case only the bytes of the data type is put)
- on Getting/Putting var-len Strings, a two-byte (little-endian) header is found before the string, giving the length. As you might expect, the string length can be anything up to the record length - 2.

DIM s AS STRING
OPEN "file.dat" FOR RANDOM AS #1 LEN = 100
  s$ = "ABCD"
  PUT #1, 1, s '' file contents: '04 00 41 42 43 44 <EOF>'
CLOSE #1

By contrast, FB Gets/Puts just the raw string data (like in Binary I/O), and gives an I/O error 3 if the size is less.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB