I am writing an application to read a motor controller via a serial MODBUS interface. Numeric data is transmitted in IEEE 754 single-precision format, so I have to store each data value in memory as 4 bytes of variable type char, then access the same memory as variable type float. This is easy to do in C using a union:
union
{
float motor_data_float;
char motor_data_char[4];
} motor_data;
The same 4-byte memory space can be accessed as a floating-point variable or as an array of 4 bytes.
How can this be implemented in VB6?
union
{
float motor_data_float;
char motor_data_char[4];
} motor_data;
The same 4-byte memory space can be accessed as a floating-point variable or as an array of 4 bytes.
How can this be implemented in VB6?