Copies part of a blob, starting at location offset for a user-defined length, and places the copy into another blob or string. The first character in a blob is always at offset 0. If the offset plus the length is greater than the total length of the blob, or if the length is -1, the copy() method copies data from the offset position to the end of the blob.
copy(int offset, int length, {blob | string} destination);
Parameter |
Description |
---|---|
offset |
Starting location to copy data. The first character in a blob is always at offset 0. |
length |
Number of characters to copy. |
destination |
blob or string in which to place the data. |
Integer. Returns the specified length of data copied, if successful, and 0, if failed.
blob other_blob;
//Blob object to place copied data into
pb->copy (5,20,&other_blob);
//copies 20 char of data, starting at an offset of 5
blob my_blob;
//places it into new_stuff
string new_stuff;
//blob object to copy data from
my_blob = “abcdefghijk”;
//string object to copy data to
my_blob.copy(4,-1,&new_stuff);
//copy data from my_blob from “e” to end of blob, and //places it into new_stuff. my_blob is unchanged and //new_stuff now contains “efghijk”.
Pointer to object |
Object |
---|---|
|
|
|
|
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |