xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

HB_DeserialBegin()

Initiates deserialization of a group of variables of simple or complex data types.

Syntax

HB_DeserialBegin( <cBinaryData> ) --> cFirstSerialdata

Arguments

<cBinaryData>
This is a character string obtained from one or multiple calls to HB_Serialize(). It holds the binary data of one ore more previously serialized variable(s).

Return

The function returns a binary character string.

Description

Function HB_DeserialBegin() prepares a binary character string holding data of serialized variables for deserialization. Actual data is extracted from <cBinaryData> with HB_DeserialNext().

Info

See also:HB_Deserialize(), HB_DeserialNext(), HB_Serialize()
Category: Serialization functions , xHarbour extensions
Source:rtl\hbsrlraw.c, rtl\hbserial.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example outlines when and where HB_DeserialBegin() is used in
// the serialization modules of xHarbour. Values of four different
// data types are serialized and converted back to their original data
// types.

   PROCEDURE Main
      LOCAL cBinary, cSerial, xValue

      cBinary := HB_Serialize( "xHarbour compiler" )
      cBinary += HB_Serialize( 123.45 )
      cBinary += HB_Serialize( StoD( "20070201" ) )
      cBinary += HB_Serialize( { 1, 2, { "a", "b" }, 3 } )

      cSerial := HB_DeserialBegin( cBinary )

      xValue  := HB_DeserialNext( @cSerial )

      DO WHILE xValue <> NIL
         ? Valtype( xValue ), ValToPrg( xValue )

         xValue  := HB_DeserialNext( @cSerial )
      ENDDO

   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe