SendBlobTo

Write a blob to any output device

Syntax

LOADLIB "wh::system.whlib";

BOOLEAN FUNCTION SendBlobTo(INTEGER outputid, BLOB data)

Parameters

INTEGER outputid

Output device to write the data to. The value 0 writes it to the standard output (the same output as @italic Print)

BLOB data

The blob to write

Return value

BOOLEAN

True if the data was written succesfully, false if an I/O error occured.

Description

This function writes the content of a blob to any output device, eg. another open blob-stream, a file or a network connection.

Examples

//Creates a combined BLOB from file1.txt and file2.txt
BLOB file1 := GetDiskResource("/tmp/file1.txt");
BLOB file2 := GetDiskResource("/tmp/file2.txt");

INTEGER mergestream := CreateStream();
SendBlobTo(mergestream, file1);
PrintTo(mergestream,"-- Above was file1, file2 follows now --");
SendBlobTo(mergestream, file2);
BLOB file1_and_2_together := MakeBlobFromStream(mergestream);