QByteArray byteArray; byteArray.push_back('H'); byteArray.push_back('e'); byteArray.push_back('l'); byteArray.push_back('l'); byteArray.push_back('o');
QByteArray byteArray("Hello"); byteArray.push_back('\0');In this example, a new QByteArray object is created with the string "Hello". The push_back function is then used to append a null byte at the end of the array, which is often used to terminate strings in C++. Depending on the platform used to compile the application, the QByteArray may be part of the core Qt package or a separate package/library called "Qt Core".