Soldered SD Card Arduino Library 1.0.0
Easily read and write files to and form the SD card breakout! A fork of the original SDFat library by Bill Greiman.
Loading...
Searching...
No Matches
SdFile Class Reference

FAT16/FAT32 file with Print. More...

#include <SdFat.h>

Inherits PrintFile< SdBaseFile >.

Public Member Functions

 SdFile ()
 
 SdFile (const char *path, oflag_t oflag)
 
- Public Member Functions inherited from PrintFile< SdBaseFile >
size_t write (uint8_t b)
 
- Public Member Functions inherited from FatFile
 FatFile ()
 
 FatFile (const char *path, oflag_t oflag)
 
 ~FatFile ()
 
 operator bool () const
 
int available () const
 
uint32_t available32 () const
 
void clearError ()
 
void clearWriteError ()
 
bool close ()
 
bool contiguousRange (uint32_t *bgnSector, uint32_t *endSector)
 
bool createContiguous (FatFile *dirFile, const char *path, uint32_t size)
 
bool createContiguous (const char *path, uint32_t size)
 
uint32_t curCluster () const
 
uint32_t curPosition () const
 
bool dirEntry (DirFat_t *dir)
 
uint16_t dirIndex () const
 
uint32_t dirSize ()
 
void dmpFile (print_t *pr, uint32_t pos, size_t n)
 
bool exists (const char *path)
 
void fgetpos (fspos_t *pos) const
 
int fgets (char *str, int num, char *delim=nullptr)
 
uint32_t fileSize () const
 
uint32_t firstBlock () const
 
uint32_t firstSector () const
 
void flush ()
 
void fsetpos (const fspos_t *pos)
 
bool getAccessDate (uint16_t *pdate)
 
bool getAccessDateTime (uint16_t *pdate, uint16_t *ptime)
 
bool getCreateDateTime (uint16_t *pdate, uint16_t *ptime)
 
uint8_t getError () const
 
bool getModifyDateTime (uint16_t *pdate, uint16_t *ptime)
 
size_t getName (char *name, size_t size)
 
size_t getSFN (char *name)
 
bool getWriteError () const
 
bool isBusy ()
 
bool isContiguous () const
 
bool isDir () const
 
bool isFile () const
 
bool isHidden () const
 
bool isLFN () const
 
bool isOpen () const
 
bool isReadable () const
 
bool isReadOnly () const
 
bool isRoot () const
 
bool isRoot32 () const
 
bool isRootFixed () const
 
bool isSubDir () const
 
bool isSystem () const
 
bool isWritable () const
 
bool ls (print_t *pr, uint8_t flags=0, uint8_t indent=0)
 
bool mkdir (FatFile *dir, const char *path, bool pFlag=true)
 
const char * name () const
 
bool open (FatVolume *vol, const char *path, oflag_t oflag)
 
bool open (FatFile *dirFile, uint16_t index, oflag_t oflag)
 
bool open (FatFile *dirFile, const char *path, oflag_t oflag)
 
bool open (const char *path, oflag_t oflag=O_RDONLY)
 
bool openNext (FatFile *dirFile, oflag_t oflag=O_RDONLY)
 
bool openRoot (FatVolume *vol)
 
int peek ()
 
bool preAllocate (uint32_t length)
 
size_t printAccessDate (print_t *pr)
 
size_t printAccessDateTime (print_t *pr)
 
size_t printCreateDateTime (print_t *pr)
 
size_t printField (double value, char term, uint8_t prec=2)
 
size_t printField (float value, char term, uint8_t prec=2)
 
template<typename Type >
size_t printField (Type value, char term)
 
size_t printFileSize (print_t *pr)
 
size_t printModifyDateTime (print_t *pr)
 
size_t printName (print_t *pr)
 
size_t printSFN (print_t *pr)
 
int read ()
 
int read (void *buf, size_t count)
 
int8_t readDir (DirFat_t *dir)
 
bool remove ()
 
bool remove (const char *path)
 
bool rename (const char *newPath)
 
bool rename (FatFile *dirFile, const char *newPath)
 
void rewind ()
 
bool rmdir ()
 
bool rmRfStar ()
 
bool seekCur (int32_t offset)
 
bool seekEnd (int32_t offset=0)
 
bool seekSet (uint32_t pos)
 
bool sync ()
 
bool timestamp (uint8_t flags, uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second)
 
bool truncate ()
 
bool truncate (uint32_t length)
 
size_t write (const char *str)
 
size_t write (uint8_t b)
 
size_t write (const void *buf, size_t count)
 
bool ls (uint8_t flags=0)
 
size_t printName ()
 

Static Public Member Functions

static void dateTimeCallback (void(*dateTime)(uint16_t *date, uint16_t *time))
 
static void dateTimeCallbackCancel ()
 
- Static Public Member Functions inherited from FatFile
static bool legal83Char (uint8_t c)
 
static void printFatDate (print_t *pr, uint16_t fatDate)
 
static void printFatTime (print_t *pr, uint16_t fatTime)
 

Detailed Description

FAT16/FAT32 file with Print.

Constructor & Destructor Documentation

◆ SdFile() [1/2]

SdFile::SdFile ( )
inline

◆ SdFile() [2/2]

SdFile::SdFile ( const char *  path,
oflag_t  oflag 
)
inline

Create an open SdFile.

Parameters
[in]pathpath for file.
[in]oflagopen flags.

Member Function Documentation

◆ dateTimeCallback()

static void SdFile::dateTimeCallback ( void(*)(uint16_t *date, uint16_t *time)  dateTime)
inlinestatic

Set the date/time callback function

Parameters
[in]dateTimeThe user's call back function. The callback function is of the form:
void dateTime(uint16_t* date, uint16_t* time) {
uint16_t year;
uint8_t month, day, hour, minute, second;
// User gets date and time from GPS or real-time clock here
// return date using FS_DATE macro to format fields
*date = FS_DATE(year, month, day);
// return time using FS_TIME macro to format fields
*time = FS_TIME(hour, minute, second);
}
static uint16_t FS_DATE(uint16_t year, uint8_t month, uint8_t day)
Definition FsDateTime.h:116
static uint16_t FS_TIME(uint8_t hour, uint8_t minute, uint8_t second)
Definition FsDateTime.h:155

Sets the function that is called when a file is created or when a file's directory entry is modified by sync(). All timestamps, access, creation, and modify, are set when a file is created. sync() maintains the last access date and last modify date/time.

◆ dateTimeCallbackCancel()

static void SdFile::dateTimeCallbackCancel ( )
inlinestatic

Cancel the date/time callback function.


The documentation for this class was generated from the following file: