strcmp函数段错误
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
int main(){
FILE *file;
char *str;
char *leftkey;
char *rightvalue;
char *key="workmodel";
file=fopen("./param.conf","r");
if(file==NULL){
printf("open file error!\n");
exit(0);
}
while(strlen(fgets(str,100,file))!=0){
char *p;
p=strtok(str,"=");
if(p) leftkey=p;
else break;
if(strcmp(key,leftkey)==0){
p=strtok(NULL,"=");
if(p) rightvalue=p;
break;
}
}
fclose(file);
int value=atoi(rightvalue);
printf("%d\n",value);
}