Philips Philips
/
LocalFileSystem_with_Rename
Rename LocalFileSystem flash memory files, thanks Doug Wendelboe for the fix
main.cpp@0:07f9467c9d46, 2012-04-02 (annotated)
- Committer:
- mbed2f
- Date:
- Mon Apr 02 20:01:38 2012 +0000
- Revision:
- 0:07f9467c9d46
LocalFileSystem with Rename
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed2f | 0:07f9467c9d46 | 1 | |
mbed2f | 0:07f9467c9d46 | 2 | #include "mbed.h" |
mbed2f | 0:07f9467c9d46 | 3 | #include "rename.h" |
mbed2f | 0:07f9467c9d46 | 4 | |
mbed2f | 0:07f9467c9d46 | 5 | LocalFileSystem local("local"); // Create the local filesystem under the name "local" |
mbed2f | 0:07f9467c9d46 | 6 | |
mbed2f | 0:07f9467c9d46 | 7 | int main() { |
mbed2f | 0:07f9467c9d46 | 8 | FILE *fp = fopen("/local/Test.txt", "w"); // Open "out.txt" on the local file system for writing |
mbed2f | 0:07f9467c9d46 | 9 | fprintf(fp, "Hello World!"); |
mbed2f | 0:07f9467c9d46 | 10 | fclose(fp); |
mbed2f | 0:07f9467c9d46 | 11 | file_rename("/local/Test.txt", "/local/new_name.txt"); |
mbed2f | 0:07f9467c9d46 | 12 | |
mbed2f | 0:07f9467c9d46 | 13 | |
mbed2f | 0:07f9467c9d46 | 14 | } |