io

Dependencies:   mbed

main.cpp

Committer:
halusis
Date:
2019-02-19
Revision:
0:fe2bb272ead2

File content as of revision 0:fe2bb272ead2:

#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);
}