Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 4 months ago.
How to write in a file with nucleo F401RE
I'm trying to write in a file but the file can't be read even if I create it before :
- include "mbed.h"
- include <stdlib.h>
- include <stdio.h>
- define TEST "test.txt"
Serial pc(SERIAL_TX, SERIAL_RX);
int main(){
FILE* fichier; if ((fichier = fopen(TEST,"w")) == NULL) Creation d'un fichier. Si apres sa création on arrive pa sà l'ouvrir alors le programme s'arrete { fprintf(stderr, "\nErreur: Impossible de lire le fichier %s\n",TEST); return(EXIT_FAILURE); }
fclose(fichier);
}
Question relating to:
2 Answers
6 years, 4 months ago.
@Rozenn, understand this reply is 3 years late but just went through a similar exercise today in an attempt to use this LocalFileSystem with W7500 board and had the same fault.
Issue is that this support for LocalFileSystem is limited to only 2 mbed boards (your Nucleo is not on that list):
https://os.mbed.com/questions/2735/LocalFileSystem-undefined/
9 years, 4 months ago.
You need to declare and open the filesystem object first. What type of file do you want to open? https://developer.mbed.org/handbook/LocalFileSystem https://developer.mbed.org/handbook/SDFileSystem
Something else?