Junyu Lu
/
Nucleo_printf
123
Revision 0:3c8241f877e9, committed 2019-10-01
- Comitter:
- lozeonjyu
- Date:
- Tue Oct 01 22:28:19 2019 +0000
- Commit message:
- 123
Changed in this revision
diff -r 000000000000 -r 3c8241f877e9 main.cpp --- /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
diff -r 000000000000 -r 3c8241f877e9 main1.cpp --- /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); +}
diff -r 000000000000 -r 3c8241f877e9 mbed.bld --- /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