a
Dependencies: SDFileSystem mbed
main.cpp
- Committer:
- goro56
- Date:
- 23 months ago
- Revision:
- 0:54cc211dbd6a
File content as of revision 0:54cc211dbd6a:
#include "mbed.h" #include "SDFileSystem.h" Serial pc(USBTX,USBRX); SDFileSystem sd(p5, p6, p7, p8, "sd"); int main() { 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"); } fprintf(fp,"Hello my name is Prelude!\r\n"); fclose(fp); fgets(str,100,fp); pc.puts(str); fclose(fp); printf("Goodbye World!\ n"); }