zoukankan      html  css  js  c++  java
  • linux c 语言之--fseek(),fseeko(),fseeko64()讲解 (转载)

    转载:http://blog.csdn.net/lemoncyb/article/details/16841317


    fseek() 函数讲解:
    函数定义:

    int fseek(FILE *stream, long offset, int fromwhere);

    int fseeko(FILE *stream, off_t offset, int fromwhere);

    int fseeko64(FILE *stream, off64_t offset, int fromwhere);


    参数:

    stream:文件指针

    fromwhere:偏移起始位置

    offset:偏移量


    功能:

    函数设置文件指针stream的位置。如果执行成功,stream将指向以fromwhere(偏移起始位置:文件头0(SEEK_SET),当前位置1(SEEK_CUR),文件尾2(SEEK_END))为基准,偏移offset(指针偏移量)个字节的位置。如果执行失败(比如offset超过文件自身大小),则不改变stream指向的位置。

    说明:这几个函数唯一的不同是offset的数据类型不同,相应的能够处理的偏移量的范围也就有大有小。


    返回值:

    成功,返回0,失败返回-1,并设置errno的值,可以用perror()函数输出错误。
    fseek position the file(文件) position(位置) pointer(指针) for the file referenced by stream to the byte location calculated by offset.

  • 相关阅读:
    AngularJS(3)-过滤器
    AngularJS(2)-Scope作用域和控制器
    iOS局部刷新
    python(一)入门
    Java基础
    AngularJS(1)随笔
    mac下如何查看指定端口被谁占用并且杀死该进程
    Python 字节码bytecode
    Python 作用域和命名空间
    Python函数的默认参数的设计【原创】
  • 原文地址:https://www.cnblogs.com/JsonZhangAA/p/9674967.html
Copyright © 2011-2022 走看看