Howto initialise char array style string in constructor

Howto initialise char array style string in constructor

I have a class which I'm serialising to send over a unix socket and it has to have a string which I've stored as a char array. Can I initialise it in the constructor differently to how I've done it here?

typedef struct SerialFunctionStatus_t {     SerialFunctionStatus_t()          : serial_rx_count(0), serial_tx_count(0), socket_rx_count(0), socket_tx_count(0)          { port[0] = '\0'; }     uint32_t serial_rx_count;     uint32_t serial_tx_count;     uint32_t socket_rx_count;     uint32_t socket_tx_count;     char port[20]; } SerialFunctionStatus_t; 

Ruby on Rails : Cannot access an object's attributes in an array


What's it called when you cast an array of objects to an array of strings?
Put port() in the initializer list.

Even more lost than before - stumped with a PHP loop [closed]
This causes port to be 'value initialized' (12.6.2), which for arrays of builtins means zero initialized (8.5)..
C# Copy Array by Value

How to check if a certain part of the array exists in another array?

85 out of 100 based on 85 user ratings 985 reviews