需要把flowuppath中的数据写入“flowuppath.txt”文件中,在试运行时出错,文件夹中有“flowuppath.txt”文件生成,就是没写入数据,请问是什么问题,怎么解决?谢谢!
#include <stdio.h>  
#include <stdlib.h>
void main()
{
int flowuppath[13]={1,2,0,5,4,8,6,7,8,0,1,2,3};
FILE *fp;
char filename[15]="flowuppath.txt";  
char ch;
if((fp=fopen(filename,"w"))=NULL)
{
cout<<"cannot open file"<<endl;
exit(0);
}
for(int i=0;i<13;i++)
{
ch=flowuppath[i];
fputc(ch,fp);
}
fclose(fp);
}