Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
10
Добавлен:
26.05.2014
Размер:
878 б
Скачать



#include <stdio.h>

main(argcount,fname)
  int argcount;
  char *fname[];

{
 FILE *in, *out;
 int ch='0';

 if (argcount<3)
   printf("Need source filename or key. \n");
 else
   if (
       (strcmp(fname[3],"-u")==0)
       ||
       (strcmp(fname[3],"-d")==0)
      )
       if ((in=fopen(fname[1],"r"))!=NULL)
	 {
	   out=fopen(fname[2],"w");
           if (out == NULL)
           { printf("Error \n");} 		
	   if (strcmp(fname[3],"-u")==0)
	     while ((ch=getc(in))!=EOF)
	      if (ch!=13)
	       {
		putc(ch,out);
                printf("ok \n");
		}
	   else
	     while ((ch=getc(in))!=EOF)
	      if (ch==10)
		{
		 putc(13,out);
		 putc(ch,out);
		}
	      else
		putc(ch,out);
	   fclose(in);
	   fclose(out);
	 }
       else
	 printf("Can't open file %s. \n",fname[1]);
   else
     printf("Invalid key.\n");
}
Соседние файлы в папке tarasov