char* filename;
\\省略了一点无关紧要的代码
......
filename=(char*)calloc(81,sizeof(char));
for(i=index+1,j=0;i<243;i++,j++) //从keyandfile字符串中选取一段放到filename里
{
if(keyandfile[i]!=' ')
{
filename[j]=keyandfile[i];
}else{
index2=i;
break;
}
}
if((fp=fopen(filename,"r"))==NULL)
{
printf("Input file not found.");
exit(0);
}