Here some help:
[list=1][*]Always check the number of arguments before you use them:
Code:
if(argc != 2)
{
printf("Usage: %s <filename>\n", argv[0]);
return -1;
}
[*]Always check return values:
Code:
if((fptr1 = fopen(argv[1], "rb")) == NULL)
{
printf("Could not open file: %s\n", argv[1]);
return -2;
}
[*]Check the return value of the getc function for EOF:
Code:
if((b[4] = getc(fptr1)) == EOF)
{
printf("Parrern not found\n");
return -3;
}
[*]Return something (0) at the end of main.
[*]Use code tags[/list=1]
Cheers,
Monster