Hello everyone,
I have a problem with my CVI project and I hope that someone can help me. I have to open a file *.bin so I have written these portion of code:
......
......
fp=fopen("C:/file1.bin","rb");
if (fp)
{
fseek(fp,0,SEEK_END);
DimFile=ftell(fp);
rewind(fp);
}
FilePtr=malloc(DimFile);
ByteRead=fread(FilePtr,1,DimFile,fp);
but I have to read the original file in binary way, this mean that every element pointed by
FilePtr has to be a single bit (0/1) so I have inserted this simple conversion byte-->bit:
Data=malloc(DimFile*8);
for (k=0;k<DimFile;k++)
{
for (i=0;i<8;i++)
*(Data +(k*8+i))=( (*(FilePtr + k)>>(i))& 0x01 );
}
the file is about 15 MB and the problem is quite simple: I have tested this code on Linux (gcc compiler) and also on Windows Xp (lcc compiler) and in both it's executed in less than 1 second but if I runs it in CVI it takes 40 seconds on the same machine and with the same file. Why??
Thanks in advance.
Message Edited by aldart on 08-16-2007 09:54 AM