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.
Revision 0:2944b34ee981, committed 2013-05-24
- Comitter:
- robt
- Date:
- Fri May 24 22:12:04 2013 +0000
- Commit message:
- by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
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 2944b34ee981 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri May 24 22:12:04 2013 +0000 @@ -0,0 +1,21 @@ +/* Program Example 10.2: Read and write text string data + */ +#include "mbed.h" +Serial pc(USBTX,USBRX); // setup terminal link +LocalFileSystem local("local"); // define local file system +char write_string[64]; // character array up to 64 characters +char read_string[64]; // create character arrays (strings) + +int main () +{ + FILE* File1 = fopen("/local/textfile.txt","w"); // open file access + fputs("lots and lots of words and letters", File1);// put text into file + fclose(File1); // close file + + FILE* File2 = fopen ("/local/textfile.txt","r"); // open file for reading + fgets(read_string,256,File2); // read first data value + fclose(File2); // close file + + pc.printf("text data: %s \n",read_string); // display read data string +} +
diff -r 000000000000 -r 2944b34ee981 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri May 24 22:12:04 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17 \ No newline at end of file