Filelen.c
上传用户:dq031136
上传日期:2022-08-08
资源大小:802k
文件大小:0k
源码类别:

VC书籍

开发平台:

C++ Builder

  1. #include <stdio.h>
  2. #include <io.h>
  3. #include <fcntl.h>
  4. #include <sysstat.h>
  5. void main(int argc, char *argv[])
  6.  {
  7.    int file_handle;
  8.    long file_size;
  9.    if ((file_handle = open(argv[1], O_RDONLY)) == -1)
  10.      printf("Error opening the file %dn", argv[1]);
  11.    else
  12.      {
  13.        file_size = filelength(file_handle);
  14.        printf("The file size in bytes is %ldn", file_size);
  15.        close(file_handle);
  16.      }
  17.  }