Promotic

Insert - method of the PmBuffer object

Description:
Inserts a new empty space inside an existing data block and enlarges the data block.
Syntax:
Long Insert(Long nOffset, Long nInsert)
Parameters:
nOffset(Long) Specifies the position in the data block where the new empty space is inserted.
>= 0 - Index (in bytes, zero-based index) in the data block.
-4 - The internal automatic position is used (see the AutoOffset property).
This operation shifts the internal automatic position to the beginning of the insertion..
nInsert(Long) The size of the inserted empty space in bytes.
Return value:
Returns the number of bytes inserted or 0 on error.
Note:
This method is not functional yet in Web panels.
See also:
- PmBuffer.SetSize (method)
- PmBuffer.Remove (method)
Example:
JavaScriptSelect and copy to clipboard

var b = Pm.CreatePmBuffer();
b.SetUint8(-2, 0x10);
b.SetUint8(-2, 0x20);
b.SetUint8(-2, 0x30);
b.SetUint8(-2, 0x40);
var s0 = b.GetHexaString(0);   // The result will be "10203040"
b.Insert(2, 1);
var s1 = b.GetHexaString(0);   // The result will be "1020003040"

History:
Pm9.00.25: Created
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.