How to convert a byte array to a std::string. Byte array contains bytes of data.
See the code below. Help me to write toStdString() function defined in ByteArray class.
Thanks
See the code below. Help me to write toStdString() function defined in ByteArray class.
Code:
int main(int argc, char *argv[]) { ByteArray byteArray; //is an array of bytes ifstream ifs ( "m1_enc.ct", ios::binary ); //binary file if ( !ifs.is_open () ) { return -1; } while( !ifs.eof() ) { //read binary data from file and put into byteArray } ifs.close(); //How to achieve this below code?; something like function toStdString() string str = QString(byteArray).toStdString() ; //Unable to achieve return 0; }
Comment