TXC.SAVEOFFSET

This field is primarily useful when outputting to a string variable that is not large enough to hold the entire text. In that case, it indicates the starting position of the next byte to be saved, relative to the beginning of the text buffer. For example, if the dst parameter was 5000 bytes long and the total size of the output text was 13000 bytes, then in the first save operation, 5000 bytes would be output to dst and TXC.SAVEOFFSET would be set to 5000. On the next call (with opcode set to TXOP_SAVE), the save operation would continue from that position, and again output until dst was full (presumably another 5000 bytes). At this point, TXC.SAVEOFFSET would be set to 10000. On the next call with opcode TXOP_SAVE, the save would start from that offset and continue to the end of the file (13000) in this case.

In another scenario, let's say that after receiving the first 5000 bytes, you decide that you would rather get it all in a single 13000 byte butter. In that case you could allocate a 13000 byte string to receive the entire block of text, and set TXC.SAVEOFFSET back to -1 so that the next save operation would re-start from the beginning. (The -1 tells the control to use the intermediate storage from the previous save operation.)