Debug Assertion Failed!
用VS2008编译,,出错!新手,大家不吝指教啊
Program:f;\VS\Convolution_first\Debug\Convolution_first.exe
File: f:\dd\vctools\crt_bld\self_x86\crt\src\fprintf.c
Line:55
Expression:(str!=NULL)
For information on how your program can cause assertion failure,see the Visual C++ documentation on asserts.
我的主函数:
#include "head.h"
int Message0[(L+m)];
int Message1[(L+m)];
int Encoded0[(L+m)];
int Encoded1[(L+m)];
int Encoded2[(L+m)];
int Transmitted0[(L+m)];
int Transmitted1[(L+m)];
int Transmitted2[(L+m)];
double Received0[(L+m)];
double Received1[(L+m)];
double Received2[(L+m)];
int Output0[(L+m)];
int Output1[(L+m)];
int Output2[(L+m)];
int Decoded0[(L+m)];
int Decoded1[(L+m)];
int Trellis_next[8][4],Trellis_current[8][4], Trellis_Code[8][4];
double SIGMA;
double BER;
char name[80]="CON.dat";
FILE *fp;
int state=(int)time(NULL);
int main()
{
srand((unsigned)time(NULL));
fp=fopen(name,"w");
fprintf(fp," EbNo BER\n");
//int total_num;
int i;
int error_frame;
int total_num;
double EbNo,No;
unsigned int errbit;
for(EbNo=INIT;EbNo!=FINAL+1;EbNo+=SNRINC) //set Eb=1;
{
errbit =0;
error_frame=0;
total_num =0;
No =1.0/pow(10.0,EbNo/10.0);
SIGMA =sqrt(No/2);
while(error_frame<Total_frame)
{
source();
channel_encode();
modulate();
channel(SIGMA);
demodulate();
channel_decode();
for(i=0;i<L;i++)
{
if(Decoded0[i]!=Message0[i])
errbit+=1;
if(Decoded1[i]!=Message1[i])
errbit+=1;
}
if(errbit!=0)
error_frame+=1;
total_num++;
if(total_num%10000==0)
{
break;
}
}
BER=(double)errbit/(double)(L*total_num);
printf ("EbNo=%5.2lfdB BER=%10.7e\n",EbNo,BER);
fprintf(fp, "%8.4lf %10.7e\n",EbNo,BER);
fflush(fp);
}
return 0;
}
[解决办法]
依次检查每个函数,看是在哪个函数里出现的错误
[解决办法]
单步调试,找到出错的语句,查看变量
[解决办法]
你要判断文件是否打开成功