email()  grow()

Chapter 5: General Objects and Methods

extend()

Description

Increases the blob to the size of the value in length and initializes the new space with the character specified in the pad parameter. The new space is always placed at the end of the existing blob data. The value in length must be greater than the current size of the blob or the method fails. You can use any standard notation in the pad parameter, including printable characters (“a”), hexadecimal notation (“0X40”), or octal notation (“\011”).

NoteThe extend() method does not place a null character (\000) at the end of the blob. If you intend to read the blob into a string object, you must add a null to the end of the blob. For example, after running the extend() method on my_blob, add my_blob +=’\000’; to add the null character.

Syntax

extend(int length, char pad);

Parameter

Description

length

Indicates how much to increase blob size.

pad

Character to use to initialize the new space. Enclose this character in single quotes.

Return value

Integer. Returns the new blob size if successful, and 0 if failed.

Examples

Example 44

blob my_blob;
my_blob = “abcdefg”;
my_blob.extend(15,’*’);

Usage

Pointer to object

Object

int newsize;

myblob.extend(newsize, ‘0xff’);

newsize = 12;

pb->extend(newsize,’’);





Copyright © 2005. Sybase Inc. All rights reserved. grow()

View this book as PDF