困惑
											#include <stdio.h>
main(){
 FILE *input,*output;
 char temp[20];
 char words[20];
 if((output=fopen("test.txt","w"))==NULL){
  printf("open file error!please check\n");
  exit(0);
  }
  printf("please input words:\n");
  gets(temp);
  if(fputs(temp,output)==EOF){
     printf("write error!please check\n");
   }
   fclose(output); 
if((input=fopen("test.txt","r"))==NULL){ printf("open file error!please have a chech\n"); exit(0); } if(fgets(words,strlen(temp-1),input)==EOF){ //问题就出在这一行 printf("read error!please check\n"); } printf("%s",words); getch(); } 当用temp+1(我觉得这才对),输出的words字符串就比我输入的字符串temp少一个字符 当用temp+2,输出的words字符串就比我输入的字符串temp少2个字符 只有当用temp-1,输出的words字符串才正确 这是为什么



 
											





 
	    

 
	


