Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 /* Program Example 10.2: Read and write text string data 00002 */ 00003 #include "mbed.h" 00004 Serial pc(USBTX,USBRX); // setup terminal link 00005 LocalFileSystem local("local"); // define local file system 00006 char write_string[64]; // character array up to 64 characters 00007 char read_string[64]; // create character arrays (strings) 00008 00009 int main () 00010 { 00011 FILE* File1 = fopen("/local/textfile.txt","w"); // open file access 00012 fputs("lots and lots of words and letters", File1);// put text into file 00013 fclose(File1); // close file 00014 00015 FILE* File2 = fopen ("/local/textfile.txt","r"); // open file for reading 00016 fgets(read_string,256,File2); // read first data value 00017 fclose(File2); // close file 00018 00019 pc.printf("text data: %s \n",read_string); // display read data string 00020 } 00021
Generated on Wed Jul 13 2022 17:53:37 by
1.7.2