AnsweredAssumed Answered

Reading file very slow on adsp 21469

Question asked by dspcoder on Oct 4, 2016
Latest reply on Oct 21, 2016 by Kader.M

Hi,

 

I am reading a text file that is 80 KB and it is taking about 40-50 seconds to read in on adsp 21469.

Is the timing normal for the board?

 

Here is snippet of the code that I wrote to read data from the file:

 

Float* ReadStimulusFromFile(char filename[], float *pSrc32)
{
   FILE *fp = fopen(filename, "r");
   char dm buffer[22];
   float dm data;
   int i = 0;

   for(i=0;i<4000;i++,pSrc32++)
   {
      fgets(buffer, sizeof(buffer),fp);
      *pSrc32 = atof(buffer);
   }

fclose(fp);
return(pSrc32);
}

 

Please let me know if there is a way to optimize the above to code to read the file faster.

 

Thanks!

Outcomes