|
Shrink
|
|
|
The Shrink method deletes block of data from file. File is shrinked by the number of bytes deleted and new file size is returned.
C++
long Shrink(
long FilePosition, // position of deletion
long BlockSize // size of data block
);
BASIC
Shrink(
FilePosition As Long // position of deletion
BlockSize As Long // size of data block
) As Long
Parameters
- FilePosition
-
Position of data block in file to be deleted.
If this parameter is -1 data is deleted from the end of file.
- BlockSize
-
Size of data block to be deleted, in bytes.
Return Values
If the method succeeds, the return value is the new size of file.
If the method fails, the return value is failure code and error code is set.
Call GetError to get error code.
Remarks
File shrinking is performed in two steps. In the first step file data present at the end of deletion position is moved backward
by the size of the data block being deleted. In the second step file is resized to remove junk data. Unsaved data present in internal
buffer is flushed to the file prior to changing its size.
See Also
Expand,
SetSize,
Copy,
Changing File Size