楼主:
momo81 (毛毛)
2014-09-28 02:22:20开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
dev c
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
问题(Question):
如程式码
想请问有什么原因会这样
谢谢
喂入的资料(Input):
strstr("This is a",读取的资料);
预期的正确结果(Expected Output):
搜寻的到
错误结果(Wrong Output):
搜不到
程式码(Code):(请善用置底文网页, 记得排版)
FILE *fPtr = fopen("A.txt","r");
char *b;
char txtvalue[10];
fgets(txtvalue, 10, fPtr);
b=strstr("This is a",txtvalue);
if(b!=0)
{
printf("%s",b);
}
fclose(fPtr);
system("PAUSE");
return 0;
A.txt里面的内容
is
a
b
这样子的话 找不到
但是只要把 strstr("This is a",txtvalue);的txtvalue写死成"is"
就找的到..
补充说明(Supplement):