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
fstream.h
Go to the documentation of this file.
1
29#ifndef fstream_h
30#define fstream_h
31#include "iostream.h"
32//------------------------------------------------------------------------------
37class StreamBaseClass : protected StreamBaseFile, virtual public ios
38{
39 protected:
41 {
43 }
44 /* Internal do not use
45 * \return mode
46 */
47 int16_t getch();
49 {
51 }
52 void open(const char *path, ios::openmode mode);
57 {
58 return m_mode;
59 }
60 void putch(char c);
61 void putstr(const char *str);
62 bool seekoff(off_type off, seekdir way);
66 bool seekpos(pos_type pos)
67 {
68 return StreamBaseFile::seekSet(pos);
69 }
74 {
75 m_mode = mode;
76 }
77 int write(const void *buf, size_t n);
78 void write(char c);
79
80 private:
82};
83//==============================================================================
89{
90 public:
91 using iostream::peek;
93 {
94 }
99 explicit fstream(const char *path, openmode mode = in | out)
100 {
101 open(path, mode);
102 }
103#if DESTRUCTOR_CLOSES_FILE
105 {
106 }
107#endif // DESTRUCTOR_CLOSES_FILE
111 void clear(iostate state = goodbit)
112 {
113 ios::clear(state);
115 }
119 void close()
120 {
122 }
145 void open(const char *path, openmode mode = in | out)
146 {
148 }
150 bool is_open()
151 {
152 return StreamBaseFile::isOpen();
153 }
154
155 protected:
157
160 int16_t getch()
161 {
162 return StreamBaseClass::getch();
163 }
167 void getpos(pos_t *pos)
168 {
170 }
174 void putch(char c)
175 {
177 }
181 void putstr(const char *str)
182 {
184 }
188 bool seekoff(off_type off, seekdir way)
189 {
190 return StreamBaseClass::seekoff(off, way);
191 }
192 bool seekpos(pos_type pos)
193 {
194 return StreamBaseClass::seekpos(pos);
195 }
196 void setpos(pos_t *pos)
197 {
199 }
200 bool sync()
201 {
202 return StreamBaseClass::sync();
203 }
204 pos_type tellpos()
205 {
207 }
209};
210//==============================================================================
216{
217 public:
218 using istream::peek;
220 {
221 }
226 explicit ifstream(const char *path, openmode mode = in)
227 {
228 open(path, mode);
229 }
230#if DESTRUCTOR_CLOSES_FILE
232 {
233 }
234#endif // DESTRUCTOR_CLOSES_FILE
238 void close()
239 {
241 }
243 bool is_open()
244 {
245 return StreamBaseFile::isOpen();
246 }
253 void open(const char *path, openmode mode = in)
254 {
256 }
257
258 protected:
260
263 int16_t getch()
264 {
265 return StreamBaseClass::getch();
266 }
270 void getpos(pos_t *pos)
271 {
273 }
277 bool seekoff(off_type off, seekdir way)
278 {
279 return StreamBaseClass::seekoff(off, way);
280 }
281 bool seekpos(pos_type pos)
282 {
283 return StreamBaseClass::seekpos(pos);
284 }
285 void setpos(pos_t *pos)
286 {
288 }
289 pos_type tellpos()
290 {
292 }
294};
295//==============================================================================
301{
302 public:
304 {
305 }
310 explicit ofstream(const char *path, openmode mode = out)
311 {
312 open(path, mode);
313 }
314#if DESTRUCTOR_CLOSES_FILE
316 {
317 }
318#endif // DESTRUCTOR_CLOSES_FILE
322 void clear(iostate state = goodbit)
323 {
324 ios::clear(state);
326 }
330 void close()
331 {
333 }
340 void open(const char *path, openmode mode = out)
341 {
343 }
345 bool is_open()
346 {
347 return StreamBaseFile::isOpen();
348 }
349
350 protected:
352
356 void putch(char c)
357 {
359 }
360 void putstr(const char *str)
361 {
363 }
364 bool seekoff(off_type off, seekdir way)
365 {
366 return StreamBaseClass::seekoff(off, way);
367 }
368 bool seekpos(pos_type pos)
369 {
370 return StreamBaseClass::seekpos(pos);
371 }
376 bool sync()
377 {
378 return StreamBaseClass::sync();
379 }
380 pos_type tellpos()
381 {
383 }
385};
386#endif // fstream_h
Basic file class.
Definition FatFile.h:112
bool sync()
Definition FatFile.cpp:1421
void fgetpos(fspos_t *pos) const
Definition FatFile.cpp:295
bool isOpen() const
Definition FatFile.h:409
uint32_t curPosition() const
Definition FatFile.h:217
bool seekSet(uint32_t pos)
Definition FatFile.cpp:1341
void fsetpos(const fspos_t *pos)
Definition FatFile.cpp:306
bool getWriteError() const
Definition FatFile.h:371
void clearWriteError()
Definition FatFile.h:173
bool close()
Definition FatFile.cpp:124
base type for FAT and exFAT streams
Definition fstream.h:38
bool getWriteError()
Definition fstream.h:48
void clearWriteError()
Definition fstream.h:40
void putch(char c)
Definition StreamBaseClass.cpp:113
bool seekoff(off_type off, seekdir way)
Definition StreamBaseClass.cpp:154
int16_t getch()
Definition StreamBaseClass.cpp:27
bool seekpos(pos_type pos)
Definition fstream.h:66
void putstr(const char *str)
Definition StreamBaseClass.cpp:126
int write(const void *buf, size_t n)
Definition StreamBaseClass.cpp:177
ios::openmode m_mode
Definition fstream.h:81
void open(const char *path, ios::openmode mode)
Definition StreamBaseClass.cpp:59
ios::openmode getmode()
Definition fstream.h:56
void setmode(ios::openmode mode)
Definition fstream.h:73
file input/output stream.
Definition fstream.h:89
fstream()
Definition fstream.h:92
void open(const char *path, openmode mode=in|out)
Definition fstream.h:145
~fstream()
Definition fstream.h:104
void close()
Definition fstream.h:119
bool is_open()
Definition fstream.h:150
fstream(const char *path, openmode mode=in|out)
Definition fstream.h:99
file input stream.
Definition fstream.h:216
ifstream(const char *path, openmode mode=in)
Definition fstream.h:226
void open(const char *path, openmode mode=in)
Definition fstream.h:253
ifstream()
Definition fstream.h:219
~ifstream()
Definition fstream.h:231
bool is_open()
Definition fstream.h:243
int32_t off_type
Definition ios.h:73
static const openmode out
Definition ios.h:143
uint8_t openmode
Definition ios.h:131
seekdir
Definition ios.h:87
uint32_t pos_type
Definition ios.h:71
static const openmode in
Definition ios.h:141
Error and state information for all streams.
Definition ios.h:423
void clear(iostate state=goodbit)
Definition ios.h:480
Input/Output stream.
Definition iostream.h:175
Input Stream.
Definition istream.h:38
int peek()
Definition istream.cpp:444
file output stream.
Definition fstream.h:301
void close()
Definition fstream.h:330
void open(const char *path, openmode mode=out)
Definition fstream.h:340
bool is_open()
Definition fstream.h:345
ofstream()
Definition fstream.h:303
ofstream(const char *path, openmode mode=out)
Definition fstream.h:310
~ofstream()
Definition fstream.h:315
Output Stream.
Definition ostream.h:38
static uint8_t mode
Definition DigitalPin.h:186
iostream class
Definition FsStructs.h:133