求高手指导C++文件打不开
此程序运行为什么结果总是“结果输出文件打不开!”求高手解答,本人新手,望海涵。#include<stdio.h>
#include<stdarg.h>
void MyBreak(char * fmt,...)
{
char buffer[256];
va_list argptr;
va_start(argptr,fmt);
vsprintf(buffer,fmt,argptr);
va_end(argptr);
#ifdef VC_EXTRALEAN
AfxMessageBox(buffer);
#else
printf(buffer);
getchar();
#endif//VC_EXTRALEAN
}
void PrintM(FILE *fp,double a[],int size,int t,char * fmt,char * title,bool IsLable)
{
if(title)fprintf(fp,"\n%s:",title);
int j=0;
for(int i=0;i<size;i++)
{
if(i%t==0)
{
j++;
if(IsLable)fprintf(fp,"\n%3d",j);
else fprintf(fp,"\n");
}
fprintf(fp,fmt,a[i]);
}
fprintf(fp,"\n");
}
void main()
{
double xy[]={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0};
FILE *fp;
fp=fopen("C:\Users\Administrator\Desktop\测量评差程序设计\result.txt","w+");
if(fp==NULL)
{
MyBreak("结果输出文件打不开!");
return;
}
PrintM(fp,xy,10,2,"%8.3lf","坐标",true);
fclose(fp);
}