qt QDataStream

    

QDataStream & QDataStream::operator<< ( qint16 i )

A data stream is a binary stream of encoded information which is 100% independent of the host computer's operating system, CPU or byte order. For example, a data stream that is written by a PC under Windows can be read by a Sun SPARC running Solaris.

You can also use a data stream to read/write raw unencoded binary data. If you want a "parsing" input stream, see QTextStream.

The QDataStream class implements the serialization of C++'s basic data types, like charshortintchar *, etc. Serialization of more complex data is accomplished by breaking up the data into primitive units.

A data stream cooperates closely with a QIODevice. A QIODevice represents an input/output medium one can read data from and write data to. The QFile class is an example of an I/O device.

Example (write binary data to a stream):

   这个数据流是一个有编码的二进制流独立于操作系统,它完全被写于主机。
For integers it is best to always cast to a Qt integer type for writing, and to read back into the same Qt integer type. This ensures that you get integers of the size you want and insulates you from compiler and platform differences.
 因为整形它是最好写入设备,
To take one example, a char * string is written as a 32-bit integer equal to the length of the string including the '\0' byte
举个列子,一个char型被写于32位的整形等同与string的长度包括 '\0' byte
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值