io

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
halusis
Date:
Tue Feb 19 02:13:19 2019 +0000
Commit message:
txt file io test

Changed in this revision

main.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
diff -r 000000000000 -r fe2bb272ead2 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Feb 19 02:13:19 2019 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+ 
+LocalFileSystem local("local");               // Create the local filesystem under the name "local"
+
+Serial pc(USBTX, USBRX); // tx, rx
+
+float pi;
+double mpi;
+unsigned int n;
+int mn;
+
+int main() {
+    FILE *fp = fopen("/local/mag.txt", "r");  // Open "out.txt" on the local file system for writing
+    //fscanf(fp, "Hello World!");
+    fscanf(fp,"%f %d %lf %d",&pi ,&n ,&mpi ,&mn);
+    fclose(fp);
+    
+    pc.printf("pi: %f n: %d mpi: %lf mn: %d",pi ,n ,mpi ,mn);
+}
\ No newline at end of file
diff -r 000000000000 -r fe2bb272ead2 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Feb 19 02:13:19 2019 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7130f322cb7e
\ No newline at end of file