LongLong

Converts data into data of type longlong. There are two syntaxes.

To

Use

Combine two unsigned long values into a longlong value

Syntax 1 For combining longs

Convert a string whose value is a number into a longlong or obtain a longlong value stored in a blob

Syntax 2 For converting strings and blobs


Syntax 1 For combining longs

Description

Combines two unsigned longs into a longlong value.

Syntax

LongLong ( lowword, highword )

Argument

Description

lowword

An UnsignedLong to be the low word in the longlong

highword

An UnsignedLong to be the high word in the longlong

Returns

LongLong. Returns the longlong if it succeeds and -1 if an error occurs. If any argument’s value is null, LongLong returns null.

Usage

Use LongLong for passing values to external C++ and Java functions.

Examples

Example 1

These statements convert the UnsignedLongs lLow and lHigh into a long value:

UnsignedLong lLow      //Low long 32 bits

UnsignedLong lHigh     //High long 32 bits

longlong LLValue       //LongLong value 64 bits


lLow = 1234567890

lHigh = 9876543210

LLValue =  LongLong(lLow, lHigh)

MessageBox("LongLong Value", LLValue)


Syntax 2 For converting strings and blobs

Description

Converts a string whose value is a number into a longlong or obtains a longlong value stored in a blob.

Syntax

LongLong ( stringorblob )

Argument

Description

stringorblob

The string you want returned as a longlong or a blob in which the first value is the longlong value. The rest of the contents of the blob is ignored. Stringorblob can also be an Any variable containing a string or blob.

Returns

LongLong. Returns the value of stringorblob as a longlong if it succeeds and 0 if stringorblob is not a valid PowerScript number or if it is an incompatible datatype. If stringorblob is null, Long returns null.

Usage

To distinguish between a string whose value is the number 0 and a string whose value is not a number, use the IsNumber function before calling the LongLong function.

Examples

Example 2

This statement returns 216789987654321 as a longlong:

LongLong("216789987654321")

Example 3

After assigning blob data from the database to lb_blob, the following example obtains the longlong value stored at position 20 in the blob:

longlong llb_num

llb_num = LongLong(BlobMid(lb_blob, 20, 4))

For an example of assigning and extracting values from a blob, see Real.

See also