I have a struct with a char array and a constructor that initializes the array with a defined String.
I want to avoid the #define
and instead pass a C++ string to the Constructor. But then again, the size of the char array is not known at compile time.
What would be a good approach to this?
#define STRING_ "myString"
struct myStruct {
int nCode;
char str1[sizeof(STRING_)];
myStruct ()
{
nLangCode = 0x0409;
strcpy(str1, STRING_ );
}
} ;