Original Post
Hey
I want to put ints, doubles etc. into a char array, for a buffer.
But right now I just get random data.
I've tried to solve this myself, and the code above is what looks most right to me. But still doesn't work...
Please help me
Thanks in advance
I want to put ints, doubles etc. into a char array, for a buffer.
But right now I just get random data.
// function to use
char *Function(void *Data, size_t Size)
{
char DataChar[50000];
memcpy(DataChar, Data, Size);
return DataChar;
}
// using
int Integer = 532;
float Float = 63.256;
std::string String = "This is a string.";
std::string Buffer = Function(&Integer, sizeof(int));
Buffer += Function(&Float, sizeof(float));
Buffer += Function(&String, String.size());
I've tried to solve this myself, and the code above is what looks most right to me. But still doesn't work...
Please help me
Thanks in advance