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

VC书籍

开发平台:

C++ Builder

  1. #include <stdio.h>
  2. void main(int argc, char *argv[])
  3.   {
  4.     FILE *fp;        // File pointer
  5.     char line[255];  // Line from file
  6.     if ((fp = fopen(argv[1], "r")) == NULL)
  7.       printf("Error opening %sn", argv[1]);
  8.     else
  9.       {
  10.         // Read and display each line of the file
  11.         while (fgets(line, sizeof(line), fp))
  12.           fputs(line, stdout);
  13.         fclose (fp);   // Close the file
  14.       }
  15.   }