Demo to read and write to both SD and USB File System
Example (more detailed example in the main.cpp file):
#include "mbed.h" #include "MSCFileSystem.h" #include "SDFileSystem.h" MSCFileSystem fs("fs"); SDFileSystem sd(p5, p6, p7, p8, "sd", p11, SDFileSystem::SWITCH_NEG_NO, 15000000); // CAUTION: Return values should ALWAYS be checked. Not shown here for brevity. int main() { ... FileHandle * sdfile = sd.open("test.txt", O_WRONLY | O_CREAT | O_TRUNC); sdfile->write("hello", 6); sdfile->close(); ... FILE * file = fopen("nextest.txt", "w"); fwrite(buffer, 1, sizeof(buffer), file); fclose(file); ... mkdir("/sd/sd_dir", 0777); mkdir("/fs/fs_dir", 0777); remove("/sd/sdfinal.log"); rename("/sd/sdfinal.txt", "/sd/sdfinal.log"); ... }
History
Example using Multi-FileSystem (which permits access to a USB Flash and an SD card from one application).
2016-03-13, by WiredHome [Sun, 13 Mar 2016 19:21:46 +0000] rev 6
Example using Multi-FileSystem (which permits access to a USB Flash and an SD card from one application).
Integrated both the SD and the USB File System drivers to permit both to be used.
2016-03-13, by WiredHome [Sun, 13 Mar 2016 01:02:58 +0000] rev 5
Integrated both the SD and the USB File System drivers to permit both to be used.
Support longer filenames
2016-03-13, by WiredHome [Sun, 13 Mar 2016 00:59:18 +0000] rev 4
Support longer filenames
Changed to support simultaneous SD and USB FileSystem
2016-03-13, by WiredHome [Sun, 13 Mar 2016 00:00:10 +0000] rev 3
Changed to support simultaneous SD and USB FileSystem
Adapted from USBFlashDiskTest
2012-10-16, by chris [Tue, 16 Oct 2012 15:47:35 +0000] rev 2
Adapted from USBFlashDiskTest
Includes the library with updated .c to .cpp file names
2012-07-23, by chris [Mon, 23 Jul 2012 09:59:38 +0000] rev 1
Includes the library with updated .c to .cpp file names
Working with new Compiler repos;
2012-07-23, by chris [Mon, 23 Jul 2012 09:35:54 +0000] rev 0
Working with new Compiler repos;