Hi , I am new in this field.
I am trying to read float values from matlab file and trying to store it in buffer of size 1024 and then passing to my fft module .
But it shows some Debug assertion problem at last.
However values are written correctly in the buffer.
plz tell me the debug assertion problem.
Here is my code
Code:int main() { FILE *fp; FILE *fp1; float line; float buffer[N]; int nwritten; int i=0; fp1=fopen("result.txt","w"); fp=fopen("decimalnewdata.txt","r"); //reading transmitted baseband data from a file if(fp==NULL) { puts("cannot open file"); exit(1); } while(!feof(fp)) /*here's my problem*/ { fscanf(fp,"%f\n", &line); /*fscanf is used, reads data from file ignoring other ascii characters*/ printf("%f\n",line); /*just for checking*/ buffer[i]=line; nwritten = fprintf(fp1,"%f\n", buffer[i]); i=i+1; } printf("%d\n",i); fclose(fp); fclose(fp1); getch(); return(0); }



LinkBack URL
About LinkBacks


