in this code i check if i'm getting data blocks in order, if not inorder i return NULL,i.e ask for next block, if in order i write the contents of data block to a file pointed by fpdddb.
the contents of DDB_Parser.BlockDataByte array keep changing every time.
what is the reason fwrite writes garbage values to the file.
DDB_Parser.BlockDataByte is of unsigned char type.
thanks in advance, if anyone looks into this code snippet.
for(;bcount<NoOfBlocks;bcount++)
{
printf("-----------------------------------------\n");
printf("DDB Module Id %x\n",DDB_Parser.ModuleId);
printf(" Data Block Number %d\n",DDB_Parser.BlockNumber);
if(bcount!= DDB_Parser.BlockNumber)
{
return NULL;
}
else
{
fwrite(DDB_Parser.BlockDataByte,blocksize,1,fpddb);
fflush(stdin);
}