SdFat
Loading...
Searching...
No Matches
Public Member Functions | List of all members
FsFile Class Reference

FsBaseFile file with Arduino Stream. More...

#include <FsFile.h>

Inheritance diagram for FsFile:
Inheritance graph
[legend]
Collaboration diagram for FsFile:
Collaboration graph
[legend]

Public Member Functions

int attrib ()
 
bool attrib (uint8_t bits)
 
int available ()
 
int available () const
 
uint64_t available64 () const
 
void clearWriteError ()
 
bool close ()
 
bool contiguousRange (uint32_t *bgnSector, uint32_t *endSector)
 
uint32_t curCluster () const
 
uint64_t curPosition () const
 
uint64_t dataLength () const
 
uint32_t dirIndex () const
 
bool exists (const char *path)
 
void fgetpos (fspos_t *pos) const
 
int fgets (char *str, int num, char *delim=NULL)
 
uint64_t fileSize () const
 
uint32_t firstSector () const
 
void flush ()
 
void fsetpos (const fspos_t *pos)
 
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 len)
 
bool getWriteError () const
 
bool isBusy ()
 
bool isContiguous () const
 
bool isDir () const
 
bool isDirectory ()
 
bool isDirectory () const
 
bool isFile () const
 
bool isFileOrSubDir () const
 
bool isHidden () const
 
bool isOpen () const
 
bool isReadable () const
 
bool isReadOnly () const
 
bool isSubDir () const
 
bool isWritable () const
 
bool ls ()
 
bool ls (print_t *pr)
 
bool ls (print_t *pr, uint8_t flags)
 
bool ls (uint8_t flags)
 
bool mkdir (FsBaseFile *dir, const char *path, bool pFlag=true)
 
bool open (const char *path, oflag_t oflag=0X00)
 
bool open (FsBaseFile *dir, const char *path, oflag_t oflag=0X00)
 
bool open (FsBaseFile *dir, uint32_t index, oflag_t oflag=0X00)
 
bool open (FsVolume *vol, const char *path, oflag_t oflag=0X00)
 
bool open (uint32_t index, oflag_t oflag=0X00)
 
bool openCwd ()
 
bool openNext (FsBaseFile *dir, oflag_t oflag=0X00)
 
FsFile openNextFile (oflag_t oflag=0X00)
 
bool openRoot (FsVolume *vol)
 
 operator bool () const
 
int peek ()
 
uint64_t position ()
 
uint64_t position () const
 
bool preAllocate (uint64_t length)
 
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)
 
int read ()
 
int read (void *buf, size_t count)
 
bool remove ()
 
bool remove (const char *path)
 
bool rename (const char *newPath)
 
bool rename (FsBaseFile *dir, const char *newPath)
 
void rewind ()
 
void rewindDirectory ()
 
bool rmdir ()
 
bool seek (uint64_t pos)
 
bool seekCur (int64_t offset)
 
bool seekEnd (int64_t offset=0)
 
bool seekSet (uint64_t pos)
 
uint64_t size ()
 
uint64_t size () const
 
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 (uint64_t length)
 
size_t write (const char *str)
 
size_t write (const uint8_t *buffer, size_t size)
 
size_t write (const void *buf, size_t count)
 
size_t write (uint8_t b)
 

Detailed Description

FsBaseFile file with Arduino Stream.

Member Function Documentation

◆ attrib() [1/2]

int FsBaseFile::attrib ( )
inlineinherited
Returns
user settable file attributes for success else -1.

◆ attrib() [2/2]

bool FsBaseFile::attrib ( uint8_t  bits)
inlineinherited

Set file attributes

Parameters
[in]bitsbit-wise or of selected attributes: FS_ATTRIB_READ_ONLY, FS_ATTRIB_HIDDEN, FS_ATTRIB_SYSTEM, FS_ATTRIB_ARCHIVE.
Note
attrib() will fail for set read-only if the file is open for write.
Returns
true for success or false for failure.

◆ available() [1/2]

int StreamFile< FsBaseFile , uint64_t >::available ( )
inlineinherited
Returns
number of bytes available from the current position to EOF or INT_MAX if more than INT_MAX bytes are available.

◆ available() [2/2]

int FsBaseFile::available ( ) const
inlineinherited
Returns
number of bytes available from the current position to EOF or INT_MAX if more than INT_MAX bytes are available.

◆ available64()

uint64_t FsBaseFile::available64 ( ) const
inlineinherited
Returns
The number of bytes available from the current position to EOF for normal files. Zero is returned for directory files.

◆ clearWriteError()

void FsBaseFile::clearWriteError ( )
inlineinherited

Clear writeError.

◆ close()

bool FsBaseFile::close ( )
inherited

Close a file and force cached data and directory information to be written to the storage device.

Returns
true for success or false for failure.

◆ contiguousRange()

bool FsBaseFile::contiguousRange ( uint32_t *  bgnSector,
uint32_t *  endSector 
)
inlineinherited

Check for contiguous file and return its raw sector range.

Parameters
[out]bgnSectorthe first sector address for the file.
[out]endSectorthe last sector address for the file.

Set contiguous flag for FAT16/FAT32 files. Parameters may be nullptr.

Returns
true for success or false for failure.

◆ curCluster()

uint32_t FsBaseFile::curCluster ( ) const
inlineinherited
Returns
The current cluster number for a file or directory.

◆ curPosition()

uint64_t FsBaseFile::curPosition ( ) const
inlineinherited
Returns
The current position for a file or directory.

◆ dataLength()

uint64_t FsBaseFile::dataLength ( ) const
inlineinherited
Returns
Total allocated length for file.

◆ dirIndex()

uint32_t FsBaseFile::dirIndex ( ) const
inlineinherited
Returns
Directory entry index.

◆ exists()

bool FsBaseFile::exists ( const char *  path)
inlineinherited

Test for the existence of a file in a directory

Parameters
[in]pathPath of the file to be tested for.

The calling instance must be an open directory file.

dirFile.exists("TOFIND.TXT") searches for "TOFIND.TXT" in the directory dirFile.

Returns
true if the file exists else false.

◆ fgetpos()

void FsBaseFile::fgetpos ( fspos_t *  pos) const
inlineinherited

get position for streams

Parameters
[out]posstruct to receive position

◆ fgets()

int FsBaseFile::fgets ( char *  str,
int  num,
char *  delim = NULL 
)
inlineinherited

Get a string from a file.

fgets() reads bytes from a file into the array pointed to by str, until num - 1 bytes are read, or a delimiter is read and transferred to str, or end-of-file is encountered. The string is then terminated with a null byte.

fgets() deletes CR, '\r', from the string. This insures only a '\n' terminates the string for Windows text files which use CRLF for newline.

Parameters
[out]strPointer to the array where the string is stored.
[in]numMaximum number of characters to be read (including the final null byte). Usually the length of the array str is used.
[in]delimOptional set of delimiters. The default is "\n".
Returns
For success fgets() returns the length of the string in str. If no data is read, fgets() returns zero for EOF or -1 if an error occurred.

◆ fileSize()

uint64_t FsBaseFile::fileSize ( ) const
inlineinherited
Returns
The total number of bytes in a file.

◆ firstSector()

uint32_t FsBaseFile::firstSector ( ) const
inlineinherited
Returns
Address of first sector or zero for empty file.

◆ flush()

void StreamFile< FsBaseFile , uint64_t >::flush ( )
inlineinherited

Ensure that any bytes written to the file are saved to the SD card.

◆ fsetpos()

void FsBaseFile::fsetpos ( const fspos_t *  pos)
inlineinherited

set position for streams

Parameters
[in]posstruct with value for new position

◆ getAccessDateTime()

bool FsBaseFile::getAccessDateTime ( uint16_t *  pdate,
uint16_t *  ptime 
)
inlineinherited

Get a file's access date and time.

Parameters
[out]pdatePacked date for directory entry.
[out]ptimePacked time for directory entry.
Returns
true for success or false for failure.

◆ getCreateDateTime()

bool FsBaseFile::getCreateDateTime ( uint16_t *  pdate,
uint16_t *  ptime 
)
inlineinherited

Get a file's create date and time.

Parameters
[out]pdatePacked date for directory entry.
[out]ptimePacked time for directory entry.
Returns
true for success or false for failure.

◆ getError()

uint8_t FsBaseFile::getError ( ) const
inlineinherited
Returns
All error bits.

◆ getModifyDateTime()

bool FsBaseFile::getModifyDateTime ( uint16_t *  pdate,
uint16_t *  ptime 
)
inlineinherited

Get a file's Modify date and time.

Parameters
[out]pdatePacked date for directory entry.
[out]ptimePacked time for directory entry.
Returns
true for success or false for failure.

◆ getName()

size_t FsBaseFile::getName ( char *  name,
size_t  len 
)
inlineinherited

Get a file's name followed by a zero byte.

Parameters
[out]nameAn array of characters for the file's name.
[in]lenThe size of the array in bytes. The array must be at least 13 bytes long. The file's name will be truncated if the file's name is too long.
Returns
The length of the returned string.

◆ getWriteError()

bool FsBaseFile::getWriteError ( ) const
inlineinherited
Returns
value of writeError

◆ isBusy()

bool FsBaseFile::isBusy ( )
inlineinherited

Check for FsBlockDevice busy.

Returns
true if busy else false.

◆ isContiguous()

bool FsBaseFile::isContiguous ( ) const
inlineinherited
Returns
True if the file is contiguous.

◆ isDir()

bool FsBaseFile::isDir ( ) const
inlineinherited
Returns
True if this is a directory else false.

◆ isDirectory() [1/2]

bool StreamFile< FsBaseFile , uint64_t >::isDirectory ( )
inlineinherited

This function reports if the current file is a directory or not.

Returns
true if the file is a directory.

◆ isDirectory() [2/2]

bool FsBaseFile::isDirectory ( ) const
inlineinherited

This function reports if the current file is a directory or not.

Returns
true if the file is a directory.

◆ isFile()

bool FsBaseFile::isFile ( ) const
inlineinherited
Returns
True if this is a normal file.

◆ isFileOrSubDir()

bool FsBaseFile::isFileOrSubDir ( ) const
inlineinherited
Returns
True if this is a normal file or sub-directory.

◆ isHidden()

bool FsBaseFile::isHidden ( ) const
inlineinherited
Returns
True if this is a hidden file else false.

◆ isOpen()

bool FsBaseFile::isOpen ( ) const
inlineinherited
Returns
True if this is an open file/directory else false.

◆ isReadable()

bool FsBaseFile::isReadable ( ) const
inlineinherited
Returns
True file is readable.

◆ isReadOnly()

bool FsBaseFile::isReadOnly ( ) const
inlineinherited
Returns
True if file is read-only

◆ isSubDir()

bool FsBaseFile::isSubDir ( ) const
inlineinherited
Returns
True if this is a sub-directory file else false.

◆ isWritable()

bool FsBaseFile::isWritable ( ) const
inlineinherited
Returns
True file is writable.

◆ ls() [1/4]

bool FsBaseFile::ls ( )
inlineinherited

List directory contents.

Returns
true for success or false for failure.

◆ ls() [2/4]

bool FsBaseFile::ls ( print_t pr)
inlineinherited

List directory contents.

Parameters
[in]prPrint object.
Returns
true for success or false for failure.

◆ ls() [3/4]

bool FsBaseFile::ls ( print_t pr,
uint8_t  flags 
)
inlineinherited

List directory contents.

Parameters
[in]prPrint object.
[in]flagsThe inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

Returns
true for success or false for failure.

◆ ls() [4/4]

bool FsBaseFile::ls ( uint8_t  flags)
inlineinherited

List directory contents.

Parameters
[in]flagsThe inclusive OR of

LS_DATE - Print file modification date

LS_SIZE - Print file size.

LS_R - Recursive list of subdirectories.

Returns
true for success or false for failure.

◆ mkdir()

bool FsBaseFile::mkdir ( FsBaseFile dir,
const char *  path,
bool  pFlag = true 
)
inherited

Make a new directory.

Parameters
[in]dirAn open FatFile instance for the directory that will contain the new directory.
[in]pathA path with a valid 8.3 DOS name for the new directory.
[in]pFlagCreate missing parent directories if true.
Returns
true for success or false for failure.

◆ open() [1/5]

bool FsBaseFile::open ( const char *  path,
oflag_t  oflag = 0X00 
)
inlineinherited

Open a file or directory by name.

Parameters
[in]pathA path for a file to be opened.
[in]oflagValues for oflag are constructed by a bitwise-inclusive OR of open flags.
Returns
true for success or false for failure.

◆ open() [2/5]

bool FsBaseFile::open ( FsBaseFile dir,
const char *  path,
oflag_t  oflag = 0X00 
)
inherited

Open a file or directory by name.

Parameters
[in]dirAn open file instance for the directory containing the file to be opened.
[in]pathA path with a valid 8.3 DOS name for a file to be opened.
[in]oflagValues for oflag are constructed by a bitwise-inclusive OR of flags from the following list

O_RDONLY - Open for reading only..

O_READ - Same as O_RDONLY.

O_WRONLY - Open for writing only.

O_WRITE - Same as O_WRONLY.

O_RDWR - Open for reading and writing.

O_APPEND - If set, the file offset shall be set to the end of the file prior to each write.

O_AT_END - Set the initial position at the end of the file.

O_CREAT - If the file exists, this flag has no effect except as noted under O_EXCL below. Otherwise, the file shall be created

O_EXCL - If O_CREAT and O_EXCL are set, open() shall fail if the file exists.

O_TRUNC - If the file exists and is a regular file, and the file is successfully opened and is not read only, its length shall be truncated to 0.

WARNING: A given file must not be opened by more than one file object or file corruption may occur.

Note
Directory files must be opened read only. Write and truncation is not allowed for directory files.
Returns
true for success or false for failure.

◆ open() [3/5]

bool FsBaseFile::open ( FsBaseFile dir,
uint32_t  index,
oflag_t  oflag = 0X00 
)
inherited

Open a file by index.

Parameters
[in]dirAn open FsFile instance for the directory.
[in]indexThe index of the directory entry for the file to be opened. The value for index is (directory file position)/32.
[in]oflagbitwise-inclusive OR of open flags. See see FsFile::open(FsFile*, const char*, uint8_t).

See open() by path for definition of flags.

Returns
true for success or false for failure.

◆ open() [4/5]

bool FsBaseFile::open ( FsVolume vol,
const char *  path,
oflag_t  oflag = 0X00 
)
inherited

Open a file or directory by name.

Parameters
[in]volVolume where the file is located.
[in]pathA path for a file to be opened.
[in]oflagValues for oflag are constructed by a bitwise-inclusive OR of open flags.
Returns
true for success or false for failure.

◆ open() [5/5]

bool FsBaseFile::open ( uint32_t  index,
oflag_t  oflag = 0X00 
)
inlineinherited

Open a file or directory by index in the current working directory.

Parameters
[in]indexThe index of the directory entry for the file to be opened. The value for index is (directory file position)/32.
[in]oflagValues for oflag are constructed by a bitwise-inclusive OR of open flags.
Returns
true for success or false for failure.

◆ openCwd()

bool FsBaseFile::openCwd ( )
inherited

Open the current working directory.

Returns
true for success or false for failure.

◆ openNext()

bool FsBaseFile::openNext ( FsBaseFile dir,
oflag_t  oflag = 0X00 
)
inherited

Opens the next file or folder in a directory.

Parameters
[in]dirdirectory containing files.
[in]oflagopen flags.
Returns
a file object.

◆ openNextFile()

FsFile FsFile::openNextFile ( oflag_t  oflag = 0X00)
inline

Opens the next file or folder in a directory.

Parameters
[in]oflagopen flags.
Returns
a FatStream object.

◆ openRoot()

bool FsBaseFile::openRoot ( FsVolume vol)
inherited

Open a volume's root directory.

Parameters
[in]volThe SdFs volume containing the root directory to be opened.
Returns
true for success or false for failure.

◆ operator bool()

FsBaseFile::operator bool ( ) const
inlineinherited

The parenthesis operator.

Returns
true if a file is open.

◆ peek()

int StreamFile< FsBaseFile , uint64_t >::peek ( )
inlineinherited

Return the next available byte without consuming it.

Returns
The byte if no error and not at eof else -1;

◆ position() [1/2]

uint64_t StreamFile< FsBaseFile , uint64_t >::position ( )
inlineinherited
Returns
the current file position.

◆ position() [2/2]

uint64_t FsBaseFile::position ( ) const
inlineinherited
Returns
the current file position.

◆ preAllocate()

bool FsBaseFile::preAllocate ( uint64_t  length)
inlineinherited

Allocate contiguous clusters to an empty file.

The file must be empty with no clusters allocated.

The file will contain uninitialized data for FAT16/FAT32 files. exFAT files will have zero validLength and dataLength will equal the requested length.

Parameters
[in]lengthsize of the file in bytes.
Returns
true for success or false for failure.

◆ printAccessDateTime()

size_t FsBaseFile::printAccessDateTime ( print_t pr)
inlineinherited

Print a file's access date and time

Parameters
[in]prPrint stream for output.
Returns
true for success or false for failure.

◆ printCreateDateTime()

size_t FsBaseFile::printCreateDateTime ( print_t pr)
inlineinherited

Print a file's creation date and time

Parameters
[in]prPrint stream for output.
Returns
true for success or false for failure.

◆ printField() [1/3]

size_t FsBaseFile::printField ( double  value,
char  term,
uint8_t  prec = 2 
)
inlineinherited

Print a number followed by a field terminator.

Parameters
[in]valueThe number to be printed.
[in]termThe field terminator. Use '\n' for CR LF.
[in]precNumber of digits after decimal point.
Returns
The number of bytes written or -1 if an error occurs.

◆ printField() [2/3]

size_t FsBaseFile::printField ( float  value,
char  term,
uint8_t  prec = 2 
)
inlineinherited

Print a number followed by a field terminator.

Parameters
[in]valueThe number to be printed.
[in]termThe field terminator. Use '\n' for CR LF.
[in]precNumber of digits after decimal point.
Returns
The number of bytes written or -1 if an error occurs.

◆ printField() [3/3]

template<typename Type >
size_t FsBaseFile::printField ( Type  value,
char  term 
)
inlineinherited

Print a number followed by a field terminator.

Parameters
[in]valueThe number to be printed.
[in]termThe field terminator. Use '\n' for CR LF.
Returns
The number of bytes written or -1 if an error occurs.

◆ printFileSize()

size_t FsBaseFile::printFileSize ( print_t pr)
inlineinherited

Print a file's size.

Parameters
[in]prPrint stream for output.
Returns
The number of characters printed is returned for success and zero is returned for failure.

◆ printModifyDateTime()

size_t FsBaseFile::printModifyDateTime ( print_t pr)
inlineinherited

Print a file's modify date and time

Parameters
[in]prPrint stream for output.
Returns
true for success or false for failure.

◆ printName()

size_t FsBaseFile::printName ( print_t pr)
inlineinherited

Print a file's name

Parameters
[in]prPrint stream for output.
Returns
true for success or false for failure.

◆ read() [1/2]

int StreamFile< FsBaseFile , uint64_t >::read ( )
inlineinherited

Read the next byte from a file.

Returns
For success return the next byte in the file as an int. If an error occurs or end of file is reached return -1.

◆ read() [2/2]

int FsBaseFile::read ( void *  buf,
size_t  count 
)
inlineinherited

Read data from a file starting at the current position.

Parameters
[out]bufPointer to the location that will receive the data.
[in]countMaximum number of bytes to read.
Returns
For success read() returns the number of bytes read. A value less than count, including zero, will be returned if end of file is reached. If an error occurs, read() returns -1. Possible errors include read() called before a file has been opened, corrupt file system or an I/O error occurred.

◆ remove() [1/2]

bool FsBaseFile::remove ( )
inherited

Remove a file.

The directory entry and all data for the file are deleted.

Note
This function should not be used to delete the 8.3 version of a file that has a long name. For example if a file has the long name "New Text Document.txt" you should not delete the 8.3 name "NEWTEX~1.TXT".
Returns
true for success or false for failure.

◆ remove() [2/2]

bool FsBaseFile::remove ( const char *  path)
inlineinherited

Remove a file.

The directory entry and all data for the file are deleted.

Parameters
[in]pathPath for the file to be removed.

Example use: dirFile.remove(filenameToRemove);

Note
This function should not be used to delete the 8.3 version of a file that has a long name. For example if a file has the long name "New Text Document.txt" you should not delete the 8.3 name "NEWTEX~1.TXT".
Returns
true for success or false for failure.

◆ rename() [1/2]

bool FsBaseFile::rename ( const char *  newPath)
inlineinherited

Rename a file or subdirectory.

Parameters
[in]newPathNew path name for the file/directory.
Returns
true for success or false for failure.

◆ rename() [2/2]

bool FsBaseFile::rename ( FsBaseFile dir,
const char *  newPath 
)
inlineinherited

Rename a file or subdirectory.

Parameters
[in]dirDirectory for the new path.
[in]newPathNew path name for the file/directory.
Returns
true for success or false for failure.

◆ rewind()

void FsBaseFile::rewind ( )
inlineinherited

Set the file's current position to zero.

◆ rewindDirectory()

void StreamFile< FsBaseFile , uint64_t >::rewindDirectory ( )
inlineinherited

Rewind a file if it is a directory

◆ rmdir()

bool FsBaseFile::rmdir ( )
inherited

Remove a directory file.

The directory file will be removed only if it is empty and is not the root directory. rmdir() follows DOS and Windows and ignores the read-only attribute for the directory.

Note
This function should not be used to delete the 8.3 version of a directory that has a long name. For example if a directory has the long name "New folder" you should not delete the 8.3 name "NEWFOL~1".
Returns
true for success or false for failure.

◆ seek()

bool StreamFile< FsBaseFile , uint64_t >::seek ( uint64_t  pos)
inlineinherited

Seek to a new position in the file, which must be between 0 and the size of the file (inclusive).

Parameters
[in]posthe new file position.
Returns
true for success or false for failure.

◆ seekCur()

bool FsBaseFile::seekCur ( int64_t  offset)
inlineinherited

Set the files position to current position + pos. See seekSet().

Parameters
[in]offsetThe new position in bytes from the current position.
Returns
true for success or false for failure.

◆ seekEnd()

bool FsBaseFile::seekEnd ( int64_t  offset = 0)
inlineinherited

Set the files position to end-of-file + offset. See seekSet(). Can't be used for directory files since file size is not defined.

Parameters
[in]offsetThe new position in bytes from end-of-file.
Returns
true for success or false for failure.

◆ seekSet()

bool FsBaseFile::seekSet ( uint64_t  pos)
inlineinherited

Sets a file's position.

Parameters
[in]posThe new position in bytes from the beginning of the file.
Returns
true for success or false for failure.

◆ size() [1/2]

uint64_t StreamFile< FsBaseFile , uint64_t >::size ( )
inlineinherited
Returns
the file's size.

◆ size() [2/2]

uint64_t FsBaseFile::size ( ) const
inlineinherited
Returns
the file's size.

◆ sync()

bool FsBaseFile::sync ( )
inlineinherited

The sync() call causes all modified data and directory fields to be written to the storage device.

Returns
true for success or false for failure.

◆ timestamp()

bool FsBaseFile::timestamp ( uint8_t  flags,
uint16_t  year,
uint8_t  month,
uint8_t  day,
uint8_t  hour,
uint8_t  minute,
uint8_t  second 
)
inlineinherited

Set a file's timestamps in its directory entry.

Parameters
[in]flagsValues for flags are constructed by a bitwise-inclusive OR of flags from the following list

T_ACCESS - Set the file's last access date and time.

T_CREATE - Set the file's creation date and time.

T_WRITE - Set the file's last write/modification date and time.

Parameters
[in]yearValid range 1980 - 2107 inclusive.
[in]monthValid range 1 - 12 inclusive.
[in]dayValid range 1 - 31 inclusive.
[in]hourValid range 0 - 23 inclusive.
[in]minuteValid range 0 - 59 inclusive.
[in]secondValid range 0 - 59 inclusive
Note
It is possible to set an invalid date since there is no check for the number of days in a month.
Modify and access timestamps may be overwritten if a date time callback function has been set by dateTimeCallback().
Returns
true for success or false for failure.

◆ truncate() [1/2]

bool FsBaseFile::truncate ( )
inlineinherited

Truncate a file to the current position.

Returns
true for success or false for failure.

◆ truncate() [2/2]

bool FsBaseFile::truncate ( uint64_t  length)
inlineinherited

Truncate a file to a specified length. The current file position will be set to end of file.

Parameters
[in]lengthThe desired length for the file.
Returns
true for success or false for failure.

◆ write() [1/4]

size_t FsBaseFile::write ( const char *  str)
inlineinherited

Write a string to a file. Used by the Arduino Print class.

Parameters
[in]strPointer to the string. Use getWriteError to check for errors.
Returns
count of characters written for success or -1 for failure.

◆ write() [2/4]

size_t StreamFile< FsBaseFile , uint64_t >::write ( const uint8_t *  buffer,
size_t  size 
)
inlineinherited

Write data to an open file.

Note
Data is moved to the cache but may not be written to the storage device until sync() is called.
Parameters
[in]bufferPointer to the location of the data to be written.
[in]sizeNumber of bytes to write.
Returns
For success write() returns the number of bytes written, always size.

◆ write() [3/4]

size_t FsBaseFile::write ( const void *  buf,
size_t  count 
)
inlineinherited

Write data to an open file.

Note
Data is moved to the cache but may not be written to the storage device until sync() is called.
Parameters
[in]bufPointer to the location of the data to be written.
[in]countNumber of bytes to write.
Returns
For success write() returns the number of bytes written, always nbyte. If an error occurs, write() returns zero and writeError is set.

◆ write() [4/4]

size_t StreamFile< FsBaseFile , uint64_t >::write ( uint8_t  b)
inlineinherited

Write a byte to a file. Required by the Arduino Print class.

Parameters
[in]bthe byte to be written. Use getWriteError to check for errors.
Returns
1 for success and 0 for failure.

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