Demonstration of a very simple unix-like shell. Based on integrating both Klaus Bu\'s SDHCFileSystem and the FATFileSystem library out of Thomas Hamilton\'s SDCard program. Result: you get high capacity + a plethora of filesystem functions.
FATFileSystem/Interface/FATDirHandle.cpp
- Committer:
- shimniok
- Date:
- 2011-10-11
- Revision:
- 0:792bddcf799d
File content as of revision 0:792bddcf799d:
/* mbed Microcontroller Library - FATDirHandle Copyright (c) 2008, sford */ //Modified by Thomas Hamilton, Copyright 2010 #include "FATDirHandle.h" FATDirHandle::FATDirHandle(FAT_DIR InputDirStr) { DirectoryObject = InputDirStr; } int FATDirHandle::closedir() { delete this; return 0; } struct dirent* FATDirHandle::readdir() { FILINFO FileInfo; FRESULT Result = f_readdir(&DirectoryObject, &FileInfo); if (Result || !FileInfo.fname[0]) { return NULL; } else { for (unsigned char i = 0; i < 13; i++) { CurrentEntry.d_name[i] = ((char*)FileInfo.fname)[i]; } return &CurrentEntry; } } void FATDirHandle::rewinddir() { DirectoryObject.index = 0; } off_t FATDirHandle::telldir() { return (off_t)DirectoryObject.index; } void FATDirHandle::seekdir(off_t location) { DirectoryObject.index = (WORD)location; }