Storages & Files Bit property
Bit Indexed, Read/Write property.

Gets/sets a single bit in the buffer. An error will occur if the index is out of range. 

Syntax:

object.Bit(index,bit[, bytes]) = value
variable =
object.Bit(index,bit[, bytes])

Parameters:

index - numeric index of a byte in the memory buffer. 

bit - bit number

bytes - default is 1 (one byte). Specifies the size of the unit in which you want the bit number to be calculated. This allows for example the 12 bit of a 32 bit value to be inspected: b = o.Bit(x,12,4).

The returned/set value is Boolean - True the bit is set, False the bit is not set.

Remarks:

This property allows you to access single bits as Boolean  values directly in the buffer. The number of the bit in the unit specified (see the bytes parameter) is calculated according to the ByteOrder specified. E.g. if the buffer is assumed big endian bit 0 will be the 0 bit of the last byte of the unit, if the buffer is assumed little endian the bit 0 will be the bit 0 in the first byte in the unit.

This method provides more convenient way to deal with flags when working with data containing bit fields of different sizes.

Applies to: SFBinaryData object

See also: ByteOrder property.

Supported on:

Windows 95/NT and later
Windows CE 3.0 and later
Pocket PC/Windows Mobile 2003 and later
Windows CE.NET 4 and later

 

newObjects Copyright 2001-2006 newObjects [ ]