我是用VB调用的,VB中有一个函数可以调用可执行文件,例如:记事本.计算器.,可以直接启动程序.可是当我调用由C生成的可执行文件时就会出现错误.如下:
debug assertion failed!
program:c\window\abc.exe
file:fscanf.c
line:54
expression:stream!=null
for information on how your program can cause an assertion failure,see the visual c++ documention on asserts.
C程序abc.cpp
#include
#include
#include "math.h"
main()
{double a[1000],b[1000],c[1000],v[1000]; file://a[],b[],c[]用来存储三个数据
int k=0,p1; file://v[]用来存储计算结果
FILE *fp1,*fp2;
fp1=fopen("c:\jj.txt","r"); file://打开存储数据的文件
while (fscanf(fp1,"%lf,%lf,%lf",&a[k],&b[k],&c[k])!=EOF) file://计算
{
v[k]=a[k]+b[k]+c[k];
k++;
}
fclose(fp1);
fp2=fopen("c:\gg.txt","w");//存入计算结果
for(p1=0;p1 {fprintf(fp2,"%1f\n",v[p1]);
printf("%1f\n",v[p1]);
}
fclose(fp2);
}
先谢谢了!
--------------------next---------------------
阅读(1140) | 评论(0) | 转发(0) |