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:0c472a310ea9, committed 2010-03-24
- Comitter:
- simon
- Date:
- Wed Mar 24 18:12:48 2010 +0000
- Commit message:
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Mar 24 18:12:48 2010 +0000
@@ -0,0 +1,26 @@
+// a way to create incrementing filenames, sford
+// every time you hit reset, will create a file with incremental filename
+
+#include "mbed.h"
+
+LocalFileSystem local("local"); // Create the local filesystem under the name "local"
+
+int main() {
+ char filename[64];
+ int n = 0;
+
+ // set "filename" equal to the next file to write
+ while(1) {
+ sprintf(filename, "/local/file%03d.txt", n); // construct the filename fileNNN.txt
+ FILE *fp = fopen(filename, "r"); // try and open it
+ if(fp == NULL) { // if not found, we're done!
+ break;
+ }
+ fclose(fp); // close the file
+ n++; // and try the next one
+ }
+
+ FILE *fp = fopen(filename, "w");
+ fprintf(fp, "I am file # %d\n", n);
+ fclose(fp);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 24 18:12:48 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0