Hello,
I want to save 20 video frame to disk using fwrite function.But I can save 6 frame to disk(file01,file02,...file06)
In this example I have fn function parameter to show frame number.
How can I overcome of this problem?
Or could you advise me another way to my problem?
Best Regards...
My code example is just like this in c function:
void videosave(void* currentFrame,int fn)
{
N=256;
char filename[128];
FILE *file;
for( i = 1; i < 2 * N * N; i+=2)
{temp[i]= *( ( (unsigned char*)currentFrame ) + i);
}
l=0;
for( i = 1; i < 2 * N * N; i+=2)
{source[l]= (unsigned int)temp[i];
source[l+1]=0;
l=l+2;
}
snprintf(filename, 128, "file%02d.txt", fn);
file = fopen(filename,"wb+");
if(file==NULL)
{printf("Error:File cannot open fn=%d \n",fn);
}
else{
fwrite(source,4,2*N*N,file);
}
}