enabled specifying numeric config values using all strtof capabilities
[clinton/Smoothieware.git] / src / libs / FileStream.h
1 #ifndef _FILESTREAM_H_
2 #define _FILESTREAM_H_
3
4 #include "StreamOutput.h"
5 #include "stdlib.h"
6
7 class FileStream : public StreamOutput {
8 public:
9 FileStream(const char *filename) { fd= fopen(filename, "w"); }
10 virtual ~FileStream(){ close(); }
11 int puts(const char *str){ return (fd == NULL) ? 0 : fwrite(str, 1, strlen(str), fd); }
12 void close() { if(fd != NULL) fclose(fd); fd= NULL; }
13 bool is_open() { return fd != NULL; }
14
15 private:
16 FILE *fd;
17 };
18
19 #endif