cancel
Showing results for 
Search instead for 
Did you mean: 

filex and directory/files

IVent.1
Senior

Hallo, this is my code.

I create a directory, and then a file in this directory. If, in another point of the code, I check if the file is present or not, I can read/write it correctly and so on.

Instead, if I stop the execution of the program, when I restart it, I don't find the file above, only the directory.

Any suggestion please? I'm struggling with it...

fxRes = fx_media_open(

&disk1,

"FS",

fx_stm32_levelx_nor_driver,

(VOID *)LX_NOR_OSPI_DRIVER_ID,

(VOID *) fx_nor_ospi_media_memory,

sizeof(fx_nor_ospi_media_memory));

if (FX_SUCCESS != fxRes) {

return;

}



if (!FolderExists(&disk1, (char*)"/DATA"))

{

fxRes=_fx_directory_create(&disk1, (char*)"/DATA");

if (FX_SUCCESS != fxRes)

{

return;

}

}

if (!FileExists(&disk1, (char*)"/DATA/file.txt"))

{

fxRes=_fx_file_create(&disk1, (char*)"/DATA/file.txt");

if (FX_SUCCESS != fxRes)

{



return;

}

}



fx_media_flush(&disk1);

fx_media_close(&disk1);
1 REPLY 1
SofLit
ST Employee

Hello @IVent.1 ,

Please kindly use </>  button to paste your code. I've edited your post then.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.