I'm trying to convert a byte array to a string in C but I can't quite figure it out.
I have an example of what works for me in C++ but I need to convert it to C.
The C++ code is below:
#include <iostream>
#include <string>
typedef unsigned char BYTE;
int main(int argc, char *argv[])
{
BYTE byteArray[5] = { 0x48, 0x65, 0x6C, 0x6C, 0x6F };
std::string s(reinterpret_cast<char*>(byteArray), sizeof(byteArray));
std::cout << s << std::endl;
return EXIT_SUCCESS;
}
Can anyone point me in the right direction?