<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ## fseek ## 移動文件流的讀寫位置 ### 相關函數 ### rewind,ftell,fgetpos,fsetpos,lseek ### 表頭文件 ### ``` #include<stdio.h> ``` ### 定義函數 ### ``` int fseek(FILE *stream, long offset, int whence); ``` ### 函數說明 ### fseek()用來移動文件流的讀寫位置。參數stream為已打開的文件指針,參數offset為根據參數whence來移動讀寫位置的位移數。 ### 參數 ### whence為下列其中一種: SEEK_SET從距文件開頭offset位移量為新的讀寫位置。SEEK_CUR 以目前的讀寫位置往后增加offset個位移量。 SEEK_END將讀寫位置指向文件尾后再增加offset個位移量。 當whence值為SEEK_CUR 或SEEK_END時,參數offset允許負值的出現。 下列是較特別的使用方式: 1) 欲將讀寫位置移動到文件開頭時:fseek(FILE *stream,0,SEEK_SET); 2) 欲將讀寫位置移動到文件尾時:fseek(FILE *stream,0,0SEEK_END); ### 返回值 ### 當調用成功時則返回0,若有錯誤則返回-1,errno會存放錯誤代碼。 ### 附加說明 ### fseek()不像lseek()會返回讀寫位置,因此必須使用ftell()來取得目前讀寫的位置。 ### 范例 ### ``` #include<stdio.h> main() { FILE * stream; long offset; fpos_t pos; stream=fopen(“/etc/passwd”,”r”); fseek(stream,5,SEEK_SET); printf(“offset=%d\n”,ftell(stream)); rewind(stream); fgetpos(stream,&pos); printf(“offset=%d\n”,pos); pos=10; fsetpos(stream,&pos); printf(“offset = %d\n”,ftell(stream)); fclose(stream); } ``` ### 執行 ### ``` offset = 5 offset =0 offset=10 ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看