[求助]改下C语言存整数的程序
#include <stdio.h>
#include <stdlib.h>
void main()
{
int i;
FILE *p;
if((p=fopen("num","r+"))==NULL)
{
p=fopen("num","w+");
i=0;
putw(i,p);
fclose(p);
}
else
{
i=getw(p);
printf("%d\n",i);
i++;
putw(i,p);
printf("%d",i);
fclose(p);
}
}
为什么每次运行都是最先给的值啊?怎么存不了??
----------------解决方案--------------------------------------------------------