首页| 论坛| 消息

标题:【提问】QT3.3.4下5GB以上的大文件读写???求救呀
作者:room502
日期:2005-07-30 17:04
内容:

qt3.3.2
如何进行qfile类的使用?at的offset如何设置?
条件编译
#if defined(QT_ABI_QT4)
typedef Q_LLONG Offset;
#else
typedef Q_ULONG Offset;
#endif
如何使用呀?


#1 [XChinux 07-30 21:43]
用C语言怎么读就怎么读。
C语言的FILE结构进行读取文件没问题的吧。。。
同样,有C++里的fstream

老天,不是吧,读5GB大的文件?与文件系统的限制有关吧。
反正一次就把它读进去不好说的吧。
可以读点丢点读点丢点,
不好意思,对这方面没有专门研究过。。。。。。
那个条件编译,是定义Offset的类型的吧。
#2 从QT Assistant里找到 [XChinux 08-01 08:54]
Example (write binary data to a stream):
QFile file("file.dat");
file.open(QIODevice::WriteOnly);
QDataStream out(&file); // we will serialize the data into the file
out str >> a; // extract "the answer is" and 42

QDataStream's binary format has evolved since Qt 1.0, and is likely to continue evolving to reflect changes done in Qt. When inputting or outputting complex types, it's very important to make sure that the same version of the stream (version()) is used for reading and writing. If you need both forward and backward compatibility, you can hardcode the version number in the application:
stream.setVersion(QDataStream::Qt_4_0);
If you are producing a new binary data format, such as a file format for documents created by your application, you could use a QDataStream to write the data in a portable format. Typically, you would write a brief header containing a magic string and a version number to give yourself room for future expansion. For example:
QFile file("file.xxx");
file.open(QIODevice::WriteOnly);
QDataStream out(&file);
// Write a header with a "magic number" and a version
out
#3 [XChinux 08-02 01:33]
我在QTForum.org上面问的这个问题,人家回答说:
chickenblood:
Reconfigure Qt with:
configure -largefile-D QT_LARGEFILE_SUPPORT -D QT_ABI_QT4
Then recompile Qt.

也就是说:重新配置QT选项,然后再编译QT一下。
#4 [room502 08-19 15:53]
谢谢,版主,ok

回复 发表
主题 版块