We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I want to read/write file in SD card by RL_FLASH, I have follow code slice:
int main(void){
int count;
int ret;
FILE *fp;
char buf[12];
count = 3;
while ((ret = finit()) != 0) {
if (!(count--)) {
break;
}
fp = fopen ("M:\\MISC\\mmc.txt","w");
if(fp == NULL)
{
return 1;
else
strcpy(buf, "abcdefg");
ret = fwrite(buf, 1, 7, fp);
fclose(fp);
while(1);
I want to create a file and write some data in it. but it crashed when it run to "ret = fwrite(buf, 1, 7, fp);", it go to HardFault_Handler().
After run this application, I put the SD card to PC to read, found the mmc.txt was created, but it's empty. why?