6
Sto provando a creare QByteArray da std :: vector .. Ho provato;Come convertire std :: vector <uint8_t> in QByteArray?
std::vector<uint8_t> buf;
QByteArray img = new QByteArray(reinterpret_cast<const char>(buf), buf.size());
Tuttavia dà errore;
error: invalid cast from type 'std::vector<unsigned char, std::allocator<unsigned char> >' to type 'const char'
Nota '.data()' è disponibile soltanto in C++ 11 e versioni successive. Se il tuo compilatore non supporta questo, usa '& buf [0]'. – Saul
quando uso buf.data() dice 'errore: cast da 'unsigned char *' a 'const char' perde precisione' – goGud
ohh .. il mio errore, non ho usato il puntatore char .. grazie mille – goGud