I want to convert a struct, which consists of various data types (long, char[x], char*), to binary and store it in a variable (I do not know the correct or optimal data type for this).
CONVERSION
For strings: I have converted every character to its ascii code and then converting the ascii code from decimal to binary.
For numbers: I have converted the number from decimal to binary.
STORAGE
I stored the output of the above conversions to char[], which consisted of '0' and '1'.
My question is, how to perform a conversion of a struct to binary and in what data type to store it. Ideally, i would like to store it in binary format, in order to perform various actions on it. (the char[] data type I used seems a little wrong, because it is string actually, not binary)
EDIT: I would prefer to avoid using libraries that are not included in standard C++.