Qt读写二进制文件

时间:2022-09-11 19:54:08

http://blog.csdn.net/mjlsuccess/article/details/22194653

http://www.cnblogs.com/weiweiqiao99/archive/2010/11/14/1877208.html

int PacketDataSaveThread::savePacketData(int id, AVPacket *pkt)
{
    int ret = 0;
    QString filename;

    filename.append(QString::number(pkt->stream_index)).append("_").append(QString::number(id)).append(".pkt");

    QFile file(filename);
    file.open(QIODevice::WriteOnly);
    file.write(QByteArray((const char *)pkt->data, pkt->size));
    file.close();

    return ret;
}