123

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
lozeonjyu
Date:
Tue Oct 01 22:28:19 2019 +0000
Commit message:
123

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
main1.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 01 22:28:19 2019 +0000
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include "mbed.h" 
+#include "LocalFileSystem.h"
+
+LocalFileSystem local("local");
+
+int main()
+{
+    FILE *fp;
+ 
+    printf("testing\n");
+ 
+    fp = fopen("/test.txt","w");
+   
+    if(fp)
+        printf("opened\n");
+    else
+        printf("not opened\n");
+   
+   
+    fprintf(fp, "This is testing for fprintf...\n");
+    fputs("This is testing for fputs...\n", fp);
+    fclose(fp);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main1.cpp	Tue Oct 01 22:28:19 2019 +0000
@@ -0,0 +1,17 @@
+#include "mbed.h"
+
+LocalFileSystem local("local");               // Create the local filesystem under the name "local"
+
+int main() {
+    FILE *fp = fopen("/local/out.txt", "w");  // Open "out.txt" on the local file system for writing
+    fprintf(fp, "Hello World!");
+    fclose(fp);
+    remove("/local/out.txt");                 // Removes the file "out.txt" from the local file system
+
+    DIR *d = opendir("/local");               // Opens the root directory of the local file system
+    struct dirent *p;
+    while((p = readdir(d)) != NULL) {         // Print the names of the files in the local file system
+      printf("%s\n", p->d_name);              // to stdout.
+    }
+    closedir(d);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 01 22:28:19 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/a7c7b631e539
\ No newline at end of file