fgetpos / fsetpos和FTELL / fseek的 [英] fgetpos/fsetpos and ftell/fseek

查看:650
本文介绍了fgetpos / fsetpos和FTELL / fseek的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么fgetpos / fsetpos和FTELL / fseek的区别?
什么是fgetpos和fsetpos好?

What's the difference between fgetpos/fsetpos and ftell/fseek? What are fgetpos and fsetpos good for?

推荐答案

好了,从手册页,我们可以看到,FTELL和fseek的利用类型长整型,重新在一个文件present偏移(位置),因此可能限于其可以重新在一长整型psented $ p $偏移。 (类型长整型不能保证持有价值超过2 ** 31-1大,限制了最大偏移量为2千兆字节)。较新的fgetpos和fsetpos功能,另一方面,使用一个特殊的typedef,fp​​os_t,重新present的偏移。这背后的typedef的类型,如果选择得当,可以重新present任意大的偏移,所以fgetpos和fsetpos可以任意大文件使用。 fgetpos和fsetpos还记录多字节流相关的状态。

Well, from the manpage we can see that ftell and fseek use type long int to represent offsets (positions) in a file, and may therefore be limited to offsets which can be represented in a long int. (Type long int is not guaranteed to hold values larger than 2**31-1, limiting the maximum offset to 2 gigabytes). The newer fgetpos and fsetpos functions, on the other hand, use a special typedef, fpos_t, to represent the offsets. The type behind this typedef, if chosen appropriately, can represent arbitrarily large offsets, so fgetpos and fsetpos can be used with arbitrarily huge files. fgetpos and fsetpos also record the state associated with multibyte streams.

这篇关于fgetpos / fsetpos和FTELL / fseek的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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