xHarbour Reference Documentation > Function Reference |
Converts values contained in a binary C structure string to an array.
HB_StructureToArray( <cBinary> , ; <aTypes> , ; [<nAlign>] , ; [<lRecurse>], ; <aStructure> ) --> aStructure
Constants for C-data types
Constant | C-data type |
---|---|
CTYPE_CHAR | char |
CTYPE_UNSIGNED_CHAR | unsigned char |
CTYPE_CHAR_PTR | char * |
CTYPE_UNSIGNED_CHAR_PTR | unsigned char* |
CTYPE_SHORT | short |
CTYPE_UNSIGNED_SHORT | unsigned short |
CTYPE_SHORT_PTR | short * |
CTYPE_UNSIGNED_SHORT_PTR | unsigned short * |
CTYPE_INT | int |
CTYPE_UNSIGNED_INT | unsigned int |
CTYPE_INT_PTR | int * |
CTYPE_UNSIGNED_INT_PTR | unsigned int * |
CTYPE_LONG | long |
CTYPE_UNSIGNED_LONG | unsigned long |
CTYPE_LONG_PTR | long * |
CTYPE_UNSIGNED_LONG_PTR | unsigned long * |
CTYPE_FLOAT | float |
CTYPE_FLOAT_PTR | float * |
CTYPE_DOUBLE | double |
CTYPE_DOUBLE_PTR | double * |
CTYPE_VOID_PTR | void * |
CTYPE_STRUCTURE | struct |
CTYPE_STRUCTURE_PTR | struct * |
The function returns the array <aStructure>.
HB_StructureToArray() is the reverse function of HB_ArrayToStructure(). It accepts a binary character string holding structure members and decodes them from their binary representation into native xHarbour data types. The resulting values are assigned to the elements of <aStructure>.
Note: conversion of structure data to/from binary is most comfortly done with declaring a C structure class using typedef struct and using the resulting C structure objects.
See also: | C Structure class, HB_ArrayToStructure(), pragma pack(), (struct), typedef struct |
Category: | C Structure support , xHarbour extensions |
Header: | cstruct.ch |
Source: | vm\arrayshb.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
http://www.xHarbour.com