Skip to content

Instantly share code, notes, and snippets.

@KowalczykBartek
Created June 19, 2016 19:22
Show Gist options
  • Save KowalczykBartek/e475583ae8074858d74d37764f1b5814 to your computer and use it in GitHub Desktop.
Save KowalczykBartek/e475583ae8074858d74d37764f1b5814 to your computer and use it in GitHub Desktop.
int sprawdzanie_argumentow(char** argv,char* argument)
{
int b = 1;
while ( b < 8 ){
if (strcmp(argv[b],argument) == 0){
printf("ARGV %s\n",argv[b]);
return 0;
}
else{
printf("ARGV = %s \n",argv[b]);
b++;}
}
return 1;
}
int main(int argc, char** argv)
{
FILE *we, *wy;
char a;
int b = 1;
int what = 0;
char* compressionFlag = "-e";
if (argc != 8 ){
pomoc();
return 0;
}
if (sprawdzanie_argumentow(argv,compressionFlag) == 0)
printf("wyszło 0 \n");
else
printf("wyszlo 1 \n");
we = fopen(argv[1],"r");
wy = fopen(argv[2],"w+");
while ((a = getc(we)) != EOF)
{
printf("%c",a);
putc(a,wy);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment