
Lectura/escritura de datos en fichero.
Revision 0:66db9a0438c9, committed 2017-03-09
- Comitter:
- jangelgm
- Date:
- Thu Mar 09 21:49:54 2017 +0000
- Commit message:
- Lectura/escritura de datos en fichero.
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 66db9a0438c9 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 09 21:49:54 2017 +0000 @@ -0,0 +1,18 @@ +/* Program Example 10.1: read and write char data bytes +*/ +#include "mbed.h" +Serial pc(USBTX,USBRX); // setup terminal link +LocalFileSystem local("local"); // define local file system +int write_var; +int read_var; // create data variables +int main () +{ + FILE* File1 = fopen("/local/datafile.txt","w"); // open file + write_var=0x23; // example data + fputc(write_var, File1); // put char (data value) into file + fclose(File1); // close file + FILE* File2 = fopen ("/local/datafile.txt","r"); // open file for reading + read_var = fgetc(File2); // read first data value + fclose(File2); // close file + pc.printf("input value = %i \n",read_var); // display read data value +} \ No newline at end of file
diff -r 000000000000 -r 66db9a0438c9 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Mar 09 21:49:54 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file