#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 256
int main (int argc, char *argv[] )
{
int i=0;
char ch;
char str[SIZE];
FILE *fp;
if (argc != 3)
exit(EXIT_FAILURE);
else
{
if ((fp = fopen (argv[2],"r")) == NULL)
exit(EXIT_FAILURE) ;
while(fgets(str,SIZE,fp))
{
if(strchr(str,argv[1][0]))
{
printf("%s",str);
memset(str,0,sizeof(str));//清空字符串
}
else
memset(str,0,sizeof(str));
}
i++;
}
fclose(fp);
return 0;
}