欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 游戏 > 用c 编写的笔记搜索程序

用c 编写的笔记搜索程序

2025/10/18 23:05:53 来源:https://blog.csdn.net/m0_59802969/article/details/147669522  浏览:    关键词:用c 编写的笔记搜索程序

@{@XXX文本记录@}@           文本记录格式     xxx 搜索词条

#include <stdio.h>
#include <string.h>
#include <stdlib.h>int main(void){FILE *f=fopen("help.txt","r");if(f==NULL){perror("file");return -1;}char nr[2000];fseek(f,0,SEEK_END);long len=ftell(f);rewind(f);char txt2[len];for(int t=0;t<len;t++){txt2[t]=fgetc(f);}
//	fclose(f);int d=0;int  wz=0;char txt1[10];char bz1[10]; int t=0;int k=0;char txt[len];char bz[14];a:       scanf("%s",bz1);strcpy(bz,"@{@");memcpy(txt,txt2,len);	 strcat(bz,bz1);printf("%s\n",bz);d=0;wz=0;memset(nr,0,2000);for(int t=0;t<(len-4);t++){if(t==(len-3))  break;if(((txt[t]=='@')&&(txt[t+1]=='{')&&(txt[t+2]=='@'))||(wz==1)){wz=1;nr[d]=txt[t];d++;}if((txt[t]='@')&&(txt[t+1]=='}')&&(txt[t+2]=='@')) {d=0; 	   wz=0;memset(txt1,0,10);	       memcpy(txt1,nr,strlen(bz));if(memcmp(bz,txt1,strlen(bz))==0){system("clear");printf("%s\n",nr);memset(nr,0,2000);memset(bz,0,10);goto a;}memset(nr,0,2000);}}puts("没有匹配函数");goto a;return 0;
}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词