Thread: Debug assertion problem

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    1

    Question Debug assertion problem

    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);
     }

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. debug problem --> chapter 5.6 K&R
    By c_lady in forum C Programming
    Replies: 2
    Last Post: 06-18-2010, 03:26 AM
  2. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  3. Debug Assertion Failure
    By gozlan in forum C Programming
    Replies: 2
    Last Post: 09-08-2002, 11:10 AM
  4. Debug Assertion error when freeing memory
    By foniks munkee in forum C Programming
    Replies: 2
    Last Post: 02-28-2002, 05:57 PM
  5. Help, Debug Problem
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 02-26-2002, 03:50 PM