UnGet


The UnGet method rollbacks last read operation and returns number of bytes actually ungot.
C++
long UnGet(
  long NumberOfBytes = -1              // number of bytes to unget
);
BASIC
UnGet(
  NumberOfBytes As Long = -1           // number of bytes to unget
) As Long

Parameters

NumberOfBytes
Number of bytes of the last operation to be ungot.
If this parameter is -1 entire data block is ungot.

Return Values

If the method succeeds, the return value is the number of bytes actually ungot.
The return value is 0 if there is nothing to unget.
If the method fails, the return value is failure code and error code is set. Call GetError to get error code.

Remarks

Method returns the number of bytes actually ungot, which may be smaller than specified; total number of bytes ungot cannot be greater than number of bytes read by last operation. GetTransfer method can be called to obtain number of bytes available for ungetting.

By specifying NumberOfBytes you can partially unget data; method can be called several times until all data read by last operation is ungot. Please note that you can rollback last Get operation only - it is not possible to rollback earlier operations nor Put operations. Method should be called immediately after read operation - unget is disabled whenever write operation occurs, file is repositioned or resized.

See Also

GetTransfer, GetBit, GetByte, GetShort, GetLong, GetFloat, GetDouble, GetText, GetUnicodeText, GetVariant, GetBinary, Reading and Writing Data