Creating a file on STM32F7 – Returns NULL
Hello Guys,
I’m working on a project using the STM32F767 evaluation board with STM32CubeIDE and FreeRTOS. In this project, I want to create a .csv file inside the MCU’s storage, write data to it, and then share that file over Ethernet.
So far, I have successfully configured the Ethernet communication and can transfer strings between the MCU and PC. However, when I try to create or open the .csv file, my fopen() call returns NULL, and the file is not created.
Code is attached with the post. Please help me.
Thanks.
FILE *f; //Golobal declare for file
void create(void ) //Function to create file,write
{
{
HAL_GPIO_WritePin(GPIOB, LD2_Pin, GPIO_PIN_SET);
f = fopen("trial.txt","w");
if(f == NULL)
{
printf("\nCann't open file");
HAL_GPIO_WritePin(GPIOB, LD2_Pin, GPIO_PIN_RESET);
}
else{
fprintf (f, "Hello World ");
fclose (f);
}
}
}
