Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

otFILE Class Reference
[FILE - Class for file managementFILE - Class for file management]

Class for file and directory management on SD.

#include <otFILE.h>


Public Types

enum  FileAccess {
  A_READ = 0x01, A_WRITE = 0x02, A_OPEN_EXISTING = 0x00, A_CREATE_NEW = 0x04,
  A_CREATE_ALWAYS = 0x08, A_OPEN_ALWAYS = 0x10, A_OPEN_APPEND = 0x30
}
enum  FileInfo {
  F_RDO = 0x01, F_HID = 0x02, F_SYS = 0x04, F_DIR = 0x10,
  F_ARC = 0x20
}
enum  FatFormat { F_FAT = 0x01, F_FAT32 = 0x02, F_EXFAT = 0x04 }
enum  Status { S_DISK, S_FAT }

Public Member Functions

 otFILE ()
bool init ()
void end ()
const char * status (U8 sel=S_DISK)
void setStdout (Stdout cb)
void setStdin (Stdin cb)
void showWriteActivity (bool ena)
FILE fopen (const char *filename, int fileAccessMode)
bool fclose (FILE f)
U32 fsize (FILE f)
U32 fsize (const char *filename)
bool fread (FILE f, void *buffer, U32 len, U32 &rlen)
bool fwrite (FILE f, void *buffer, U32 len, U32 &wlen)
bool fseek (FILE f, U32 pos)
U32 ftell (FILE f)
bool fputs (const char *text, FILE f, U32 *written=0)
char * fgets (char *buffer, U32 bufferSize, FILE f)
bool fputc (char ch, FILE f)
char fgetc (FILE f, bool *ok=0)
char * fgetline (FILE f, U32 maxLen=4096, char eol= '\n')
bool ftruncate (FILE f)
bool fsync (FILE f)
bool feof (FILE f)
int fprintf (FILE f, const char *fmt,...)
int fscanf (FILE f, const char *fmt,...)
bool fsave (const char *filename, void *src, U32 len)
bool fsave (FILE f, const char *data, U32 n)
bool fsave (FILE f, U8 data)
bool fsave (FILE f, U16 data)
bool fsave (FILE f, U32 data)
bool fload (FILE f, U8 &data)
bool fload (FILE f, U16 &data)
bool fload (FILE f, U32 &data)
void * fload (const char *filename, U32 &len, bool &ok)
FINF fnew ()
void fend (FINF d)
FDIR dnew ()
void dend (FDIR d)
bool dopen (FDIR dir, const char *path)
bool dread (FDIR dir, FINF fno)
bool dfindfirst (FDIR dir, FINF fno, const char *path, const char *pattern)
bool dfindnext (FDIR dir, FINF fno)
bool dclose (FDIR dir)
bool stat (const char *path, FINF fno)
bool unlink (const char *path)
bool rename (const char *old_name, const char *new_name)
bool chmod (const char *path, U8 attr, U8 mask)
bool utime (const char *path, FINF fno)
bool mkdir (const char *path)
bool chdir (const char *path)
bool chdrive (const char *path)
bool getcwd (void *buffer, U32 len)
bool copy (const char *src_name, const char *dst_name)
bool move (const char *src_name, const char *dst_name)
bool ls (const char *path, int displayLine=20)
bool type (const char *src_name, int displayLine=20)
bool format (const char *diskLabel="", int fmt=F_FAT32, U32 sectorSize=0)
bool mount (bool on)
bool setLabel (const char *diskLabel)
bool getLabel (char *diskLabel)
U32 free ()
bool isActive ()

Static Public Attributes

static Stdout _stdout


Member Enumeration Documentation

enum otFILE::FatFormat
 

Enumeration values:
F_FAT  FAT12.
F_FAT32  FAT32.
F_EXFAT  Extensible File Allocation Table) is a file system introduced by Microsoft in 2006 and optimized for flash memory such as USB flash drives and SD cards.

enum otFILE::FileAccess
 

Enumeration values:
A_READ  Specifies read access to the object. Data can be read from the file.
A_WRITE  Specifies write access to the object. Data can be written to the file. Combine with FA_READ for read-write access.
A_OPEN_EXISTING  Opens the file. The function fails if the file is not existing. (Default).
A_CREATE_NEW  Creates a new file. The function fails with FR_EXIST if the file is existing.
A_CREATE_ALWAYS  Creates a new file. If the file is existing, it will be truncated and overwritten.
A_OPEN_ALWAYS  Opens the file if it is existing. If not, a new file will be created.
A_OPEN_APPEND  Same as FA_OPEN_ALWAYS except the read/write pointer is set end of the file.

enum otFILE::FileInfo
 

Enumeration values:
F_RDO  Read only.
F_HID  Hidden.
F_SYS  System.
F_DIR  Directory.
F_ARC  Archive.

enum otFILE::Status
 

Enumeration values:
S_DISK  Low level disk (SD) status.
S_FAT  FatFs error codes.


Constructor & Destructor Documentation

otFILE.otFILE  ) 
 


The documentation for this class was generated from the following file: footer
otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0