zoukankan      html  css  js  c++  java
  • C语言

      原型:int fseek(FILE *stream, long int offset, int whence)
      
      参数解释:
          FILE *stream - 文件流,要打开的文件指针
          long int offset - 一个长整型数据类型 offset 表示偏移量,偏移字节数  
          int whence - 起始位置(从这开始偏移)
                 【SEEK_SET:0,文件开头;SEEK_END:2,文件末尾;SEEK_CUR:1,文件指针当前位置】


      注:fseek 受文件的打开方式影响,
        如以 r+,打开文件的指针指向文件开头;
        以 a/a+ 打开文件的指针在文件尾部,fseek 移动文件指针无效

      例子:
        *fseek 与 fwrite 结合使用
         int size = sizeof(student);
            int offset = (SN - 1)*size;
            fseek(file, offset , SEEK_SET);
            fwrite(&newStd,sizeof(student),1,file);
        
    ...................................................
  • 相关阅读:
    AOD.net
    C# Eval()和Bind()
    .Net使用微軟自帶的用戶驗證和登錄授權
    .Net面試4套
    .Net面試題
    MVC开发模式
    .Net自帶Ajax和GridView
    HTML系列(HTMl+CSS+JavaScript+Jquery)--un
    .Net母版页
    .NetDOM操作--un
  • 原文地址:https://www.cnblogs.com/floakss/p/10585031.html
Copyright © 2011-2022 走看看