#define_CRT_SECURE_NO_WARNINGS#includestdio.h#includestdlib.h#includestring.hchar**pp=NULL;voidinitdatatomem(char*path){pp=(char**)malloc(sizeof(char*)*10180807);FILE*p=fopen(path,r);if(p==NULL){printf(打开失败\n);}else{for(inti=0;i10180807;i++){charstr[275]={0};fgets(str,275,p);intstrlength=strlen(str)+1;char*px=(char*)malloc(sizeof(char)*strlength);strcpy(px,str);str[strlength-1]='\0';pp[i]=px;}}printf(载入内存ok\n);}intgetsize(char*path){FILE*p=fopen(path,r);if(p==NULL){printf(打开失败\n);return-1;}else{fseek(p,0,SEEK_END);intnum=ftell(p);returnnum;}fclose(p);}intgetn(char*path){FILE*p=fopen(path,r);if(p==NULL){printf(打开失败\n);return-1;}else{intnum=0;while(!feof(p)){charstr[275]={0};fgets(str,275,p);num++;}returnnum;}fclose(p);}//13180807voidfindstr(char*str){for(inti=0;i10180807;i++){char*ppp=strstr(pp[i],str);if(ppp!=NULL){printf(\n%s,pp[i]);}}}voidmain(){char*path=C:\\Users\\xiaokang\\Desktop\\dangdangwang.txt;initdatatomem(path);charstr[100]={0};scanf(%s,str);findstr(str);system(pause);}