首页| 论坛| 消息

标题:【提问】请问我如何保存整形原始数据的文件?还有如何读出的问题?
作者:brada88
日期:2006-02-20 05:34
内容:

好像QFile读出和写入只是操作char型的


#1 [XChinux 02-20 05:43]
可用QString类的成员函数进行转换成整型或者浮点型
#2 [cavendish 02-20 09:42]
QByteArray
char *可以存储任意类型的数据呀
#3 [tieliu 02-24 21:13]
保存:
int num1 = 10235;
int num2 = 10232;
int num3 = 102435;
QFile file( "file.dat" );
file.open( IO_WriteOnly );
QDataStream stream( &file );
stream > num3;
stream>> num3;
请参考以下参考QFile类和QDataStream类文档

回复 发表
主题 版块