소스 검색

Update test.c

DongwenHuang 10 년 전
부모
커밋
4132e9301d
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      test.c

+ 1 - 1
test.c

@@ -44,7 +44,7 @@ void doit(char *text)
 void dofile(char *filename)
 {
 	FILE *f=fopen(filename,"rb");fseek(f,0,SEEK_END);long len=ftell(f);fseek(f,0,SEEK_SET);
-	char *data=(char*)malloc(len+1);fread(data,1,len,f);fclose(f);
+	char *data=(char*)malloc(len+1);fread(data,1,len,f);data[len]='\0';fclose(f);
 	doit(data);
 	free(data);
 }