So I was trying to pass a struct to a function and change its value. Below is my struct definition
Code: Select all
struct FileRoutines{
int drv;
F_FILE* fp;
};
Code: Select all
...
FileRoutines OpenOnboardSD;
OpenFileRoutine(&OpenOnboardSD);////////////////////////Output 1/////////////////////////
iprintf("Main Code drv value=%d\n",OpenOnboardSD.drv);////////////////////////Output 2////////////////////////
...
Code: Select all
void OpenFileRoutine(struct FileRoutines* OpenOnboardSD) {
f_enterFS();
char File_name[6];
OpenOnboardSD->drv = OpenOnBoardFlash();
int *card_status = initOnBoardSD(OpenOnboardSD->drv);
sprintf(File_name, "LOG%d.txt", card_status[1] + 1);
OpenOnboardSD->fp = f_open(File_name, "w+");
iprintf("Local drv value=%d\n", OpenOnboardSD->drv);////////////Output 1/////////////////
}
Regards,
TM