一般fopen时要判断下:if((fp = fopen("1000.txt","r")) == NULL){ printf("error open file!\n"); exit(0);}好像没什么问题了。再就是楼主编程风格太烂了。建议上网找下《高质量c++、c 编程指南》看看。