非常初学者的问题-C中的数字更大 [英] Very beginner question.-Bigger numbers in C

查看:174
本文介绍了非常初学者的问题-C中的数字更大的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在较大的文件中导航.
我正在使用gcc,但使用borland C ++和Microsoft Visual C ++(附加到Express Edition)
会类似.

整数类型(取决于系统)只有32位大(我也可以使用long型,但是它们的大小相同).
使用32类型无法使用lseek导航大于4GB的大文件(如分区图像).

在头文件中,定义了off_t,但它也是32位(4个字节长).
在该文件中还有其他可能使用lseek的可能性,还是我应该寻找其他方法(也许是编译器选项,或者应该定义一些东西以获得64位off_t.)
(也许您知道任何有关此主题的文献都值得阅读.)
感谢您提供任何答案.

I would like to know how to navigate in larger files.
I am using gcc, but borland C++ as well as Microsoft Visual C++(attached to Express Edition)
would be similar.

Integer type is (depending on system) only 32bit large (I can use long as well, but they are same size).
Using lseek to navigate in large files (like partition image) bigger than 4GB is impossible using 32 type.

In header file, there is defined off_t, but it is 32 bit (4 bytes long) too.
Are there any other possibilities to use lseek in that file or should I look for other methods (maybe compiler option or something I should define to get 64 bit off_t.)
(Perhaps you know any literature worth reading on this topic.)
Thanks for any answers.

推荐答案

fgetposfsetpos是您最好的选择,例如,请参见[
fgetpos, fsetpos are your best bet, see, for instance [^].
:)


这篇关于非常初学者的问题-C中的数字更大的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆