IiopSetBinaryFromFile Function

Action

Reads binary data from a file and associates the data with a CORBA object. This function can be used to set parameters of a request in advance of calling the IiopRequest function.

Include file

IIOP.bdh

Syntax

IiopSetBinaryFromFile(in hIiop : number,
                      in sFile : string,
                      in nBytes : number optional,
                      in nAlign : number optional): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hIiop Handle to a CORBA object
sFile Name of the file containing the binary data. If NULL, the filename passed to the previous IiopSetBinaryFromFile function call (belonging to the same request) is used
nBytes Number of bytes to read from the file. If omitted or zero, the whole file is read.
nAlign

Binary data alignment (optional). Possible options are:

  • IIOP_ALIGN_2. Alignment to 2-byte boundaries

  • IIOP_ALIGN_4. Alignment to 4-byte boundaries

  • IIOP_ALIGN_8. Alignment to 8-byte boundaries

  • IIOP_ALIGN_16. Alignment to 16-byte boundaries

Default setting is alignment to 1-byte boundaries.

Example

// send a large graphic file to a printer object
dcltrans
  transaction TSetBinaryFromFile
  const
    FRAGMENTSIZE := 4096;
    FILENAME := "IMAGE.GIF";
  var
    hIiop, nFragments, nFilesize, i: number;
  begin
    // retrieve handle to CORBA object, filesize and
    // number of fragments
    ...
    // send fragmented messageIiopSetBinaryFromFile(hIiop, FILENAME, nFilesize MOD FRAGMENTSIZE);
    for i := 1 to nFragments do

    // indicate begin of new fragment
    IiopSetFragment(hIiop);

    // send next fragment
    IiopSetBinaryFromFile(hIiop, NULL, FRAGMENTSIZE);
    end;
    IiopRequest(hIiop, "print", IIOP_USE_V11);
  end TSetBinaryFromFile;