[Documentation] [TitleIndex] [WordIndex

Overview

Currently just fundamental type <-> byte array converters. These are common for control io operations (e.g. on a serial port).

Compiling & Linking

   1 #include <ecl/converters_lite.hpp>
   2 
   3 // The converter functions
   4 // int32/uint32 -> char*, uchar*
   5 using ecl::from_byte_array; 

Examples

Take char when using the byte arrays to make sure that the required number of chars is available for the conversion. There is no way of catching this error except via segfault. For robust converters, see ecl_converters.

   1 ecl::int32 value;
   2 char minus_two[4] = { 0xfe, 0xff, 0xff, 0xff };
   3 unsigned char u_minus_two[4] = { 0xfe, 0xff, 0xff, 0xff };
   4 ecl::from_byte_array(value,minus_two);  // value=-2
   5 ecl::from_byte_array(value,u_minus_two); // value=-2 
   6 


2024-06-15 12:55