Hi Rahul,
I tested your code at my TWR-K21F120M board.
- I never meet branch with disk format. Therefore I just simply copy this code prior write into the file.
- FLASH_IOCTL_WRITE_PROTECT is FlashX ioctl command, therefore I suppose, that you should use flashHandle instead of filesysHandle for such command. However I suppose, that you don't need it in this case at all.
- The most important point is that seek function doesn’t return size of file (just OK or error). Please use this fix in your code:
fseek(filePtr, 0, IO_SEEK_END);
i = ftell(filePtr);
fseek(filePtr, 0, IO_SEEK_SET);
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------