#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char buff[128];
char *match;
FILE* fd;
int rdbyt;
fd=fopen("F:/Downloads/test.txt","r");
if(fd<0) {
printf("open file error\n");
return -1;
}
rdbyt = fread(buff,1,sizeof(buff),fd);
fclose (fd);
if(rdbyt<0) {
printf("read error\n");
return -1;
}
buff[rdbyt] = '\0';
printf("%s\n",buff);
match = strstr(buff,"dir=");
if(match==0) printf("no match\n");
else {
sscanf(match,"dir=%s",buff);
}
printf("%s\n",buff);
return 0;
}
运行结果:
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。