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: SDFileSystem mbed
Fork of SDFileSystem_HelloWorld by
main.cpp
- Committer:
- CRaslawski
- Date:
- 2017-02-27
- Revision:
- 1:e8f7210820fa
- Parent:
- 0:bdbd3d6fc5d5
File content as of revision 1:e8f7210820fa:
#include "mbed.h" #include "SDFileSystem.h" #include <stdio.h> SDFileSystem sd(p11, p12, p13, p8, "sd"); // the pinout on the mbed Cool Components workshop board char myline[100]; //define MAXLINE 100 char myline [MAXLINE];/* int i, inch;*/ int main() { printf("Hello World!\n"); mkdir("/sd/mydir", 0777); FILE *fp = fopen("/sd/mydir/sdtest.txt", "w"); if(fp == NULL) { error("Could not open file for write\n"); } fprintf(fp, "Hello SD file World!"); fclose(fp); printf("Goodbye World!\n"); FILE *fp2 = fopen("/sd/mydir/sdtest.txt", "r"); if(fp == NULL) { error("Could not open file for write\n"); } //fgets(fp2,"%s",myline); else { if(fgets(myline,100,fp2)!=NULL) { printf("Opened file for read.\n"); printf("\n\rRead from SD card file:\"%s\"",myline); puts(myline); } } fclose(fp2); printf("stuff"); //printf("Opened file for read.\n"); //printf("\n\rRead from SD card file:\"%s\"",myline); //fclose(fp2); }