[C] 取得当前文件的句柄 →→→→→进入此内容的聊天室

来自 , 2020-01-08, 写在 C, 查看 152 次.
URL http://www.code666.cn/view/b0b79da5
  1. #include <string.h>
  2. #include <stdio.h>
  3.  
  4. int main ( void )
  5. {
  6.         FILE *stream;
  7.         char string[] = "This is a test";
  8.         fpos_t filepos;
  9.  
  10.         /* open a file for update */
  11.         stream = fopen ( "DUMMY.FIL", "w+" );
  12.  
  13.         /* write a string into the file */
  14.         fwrite ( string, strlen ( string ), 1, stream );
  15.  
  16.         /* report the file pointer position */
  17.         fgetpos ( stream, &filepos );
  18.         printf ( "The file pointer is at byte\
  19.          %ld\n", filepos );
  20.  
  21.         fclose ( stream );
  22.         return 0;
  23. }
  24.  

回复 "取得当前文件的句柄"

这儿你可以回复上面这条便签

captcha