Bài tập C cơ bản - HIENFILE.C

Một số bài tập thời còn đi học, dọn ổ backup lên blog :>>

----------------
#include <stdio.h>

void main(int argc, char *argv[])
{
  FILE *fp;
  char c;

  if (argc <= 1)
    printf("\nCach su dung : \nHienfile <ten tap tin>");
  else
    if ((fp = fopen(argv[1], "r")) == NULL)
       printf("\nKhong the mo tap tin %s", argv[1]);
    else
    {
       while ((c = fgetc(fp)) != EOF)
         putc(c, stdout);
    }
  getch();
}
----------------










No comments:

Post a Comment