|
Expand
|
|
|
The Expand method inserts block of data into file. File is expanded by the number of bytes inserted and new file size is returned.
C++
long Expand(
long FilePosition, // position of insertion
long BlockSize // size of data block
);
BASIC
Expand(
FilePosition As Long // position of insertion
BlockSize As Long // size of data block
) As Long
Parameters
- FilePosition
-
Position of data block in file to be inserted at.
If this parameter is -1 data is appended at the end of file.
- BlockSize
-
Size of data block to be inserted, 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 expansion is performed in two steps. In the first step file is resized to make room for the new data block.
In the second step file data present at the insertion position is moved forward by the size of the data block being inserted. File data in newly created space is not cleared - it contains data previously present at the insertion position.
Unsaved data present in internal buffer is flushed to the file prior to changing its size.
See Also
Shrink,
SetSize,
Copy,
Changing File Size