All pastes #735138 Raw Edit

Untitled

public text v1 · immutable
·published 2007-10-13 10:58 UTC
rendered paste body
#include <stdio.h>
main(argc,argv)
int argc;
char *argv[];
{
FILE *in,*out;
int ch;
char name[40];
int count=0;

if ( argc < 2)
{
fprintf(stderr,"need name file\n");
exit(1);
}

if ( ( in=fopen(argv[1],"r"))==NULL)
{
fprintf(stderr,"dn mporo na anoikso to arxio\n");
exit(2);
}

strcpy(name,argv[1]);
strcat(name,".red");
if ( (out=fopen(name,"w")) ==NULL)
{
fprintf(stderr,"dn mporo na dimioyrgiso arxio eksodoy\n");
exit(3);
}
while ( ( ch=getc(in)) !=EOF)
if( count++ %3==0)
putc(ch,out);
fclose(in);
fclose(out);
}