Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed SDFileSystem
main.cpp
- Committer:
- HEPTA
- Date:
- 2017-09-07
- Revision:
- 13:4fb761757895
- Parent:
- 10:4d6870d0caa0
- Child:
- 14:1c1a7c1f1228
File content as of revision 13:4fb761757895:
#include "mbed.h" #include "SDFileSystem.h" Serial pc(USBTX,USBRX); SDFileSystem sd(p5, p6, p7, p8, "sd"); int main(){ pc.baud(9600); pc.printf("Hello world!\r\n"); char str[100]; mkdir("/sd/mydir", 0777); FILE *fp = fopen("/sd/mydir/test.txt","w"); if(fp == NULL) { error("Could not open file for write\r\n"); } for(int i=0; i<10; i++)fprintf(fp,"Hello my name is HEPTA!\r\n"); fclose(fp); fp = fopen("/sd/mydir/test.txt","r"); fgets(str,100,fp); puts(str); fclose(fp); pc.printf("Goodbye!!\r\n"); }