truncate()  Database interface objects

Chapter 5: General Objects and Methods

write()

Description

Writes the blob contents to the file specified in the filename parameter. If the file does not exist, this method creates the file at the location specified. If the file already exists, the write() method appends the contents of the blob to the end of the file. To overwrite an existing file, use the save() method.

Syntax

write(string filename);

Parameter

Description

filename

The name of the file in which to save the blob contents. Can be a string or a literal and can contain a drive and path designation as well as the filename. All backslashes (\) must be escaped (\\). Enclose a literal in double-quotes.

Return value

Integer. Returns the number of bytes written to the file, if successful, and the negative value of the UNIX error that caused the method to fail, if failed.

Usage

Pointer to object

Object

pb->write(“./newfile.blo”);

string new_file;

pb->write    (“c:\\new\\files\\pb_file”);

new_file = “/tmp/pb_hold”;

myblob.write(new_file);

myblob.write("./newfile.blo");

myblob.write    ("c:\\new\\files\\pb_file");





Copyright © 2005. Sybase Inc. All rights reserved. Database interface objects

View this book as PDF