![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Ecriture d'unfichier sur mbed pour sauvegarde de données
Fork of LocalFileSystem_HelloWorld by
main.cpp@1:a4757252e0ae, 2017-06-22 (annotated)
- Committer:
- LouisReynier
- Date:
- Thu Jun 22 13:03:49 2017 +0000
- Revision:
- 1:a4757252e0ae
- Parent:
- 0:cc465aef98cf
Exemple ?criture d'un fichier sur mbed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:cc465aef98cf | 1 | #include "mbed.h" |
mbed_official | 0:cc465aef98cf | 2 | |
mbed_official | 0:cc465aef98cf | 3 | LocalFileSystem local("local"); // Create the local filesystem under the name "local" |
mbed_official | 0:cc465aef98cf | 4 | |
mbed_official | 0:cc465aef98cf | 5 | int main() { |
LouisReynier | 1:a4757252e0ae | 6 | int tablo[6] = {4, 8,15, 16, 23, 46}; |
LouisReynier | 1:a4757252e0ae | 7 | int i = 0; |
LouisReynier | 1:a4757252e0ae | 8 | FILE *fp = fopen("/local/compil.txt", "w"); // Open "out.txt" on the local file system for writing |
LouisReynier | 1:a4757252e0ae | 9 | for (i =0; i<6; i++) |
LouisReynier | 1:a4757252e0ae | 10 | { |
LouisReynier | 1:a4757252e0ae | 11 | fprintf(fp, "%d \n", tablo[i]); |
LouisReynier | 1:a4757252e0ae | 12 | } |
mbed_official | 0:cc465aef98cf | 13 | fclose(fp); |
mbed_official | 0:cc465aef98cf | 14 | } |