xtest.c

来自「国外网站上的一些精典的C程序」· C语言 代码 · 共 44 行

C
44
字号
/* +++Date last modified: 05-Jul-1997 */#include <stdio.h>#include "xfile.h"#ifdef __WATCOMC__ #pragma off (unreferenced);#endif#ifdef __TURBOC__ #pragma argsused#endifint main(int argc, char **argv){      while (*++argv != 0)      {            XFILE *f = xopen(*argv);            if (f == 0)                  fprintf(stderr, "ERROR: can't open file %s\n", *argv);            else            {#if 0                  char *s;                  fprintf(stdout, "--- %s ---\n", *argv);                  while ((s = xgetline(f)) != NULL)                        fputs(s, stdout);                  xclose(f);#else                  unsigned int nLines = 0;                  char *s;                  while (xgetline(f) != NULL)                        ++nLines;                  printf("%5u lines in %s\n", nLines, *argv);                  xclose(f);#endif            }      }      return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?