帮忙! 自己写的计数函数出错!
#include<stdio.h>#include<iostream.h>
void main()
{ int c=0;
FILE *fp;
if((fp=fopen("c:\\count.txt","wt+"))==NULL)
{
cout<<"can not open file"<<endl;
getchar();
}
c=fgetc(fp);
c++;
fputc(c,fp);
cout<<c<<endl;
fclose(fp);
}
能通过编译,但是文件不能写入, 达人帮忙啊!