Merge Network code with webserver etc
[clinton/Smoothieware.git] / src / libs / FileStream.h
CommitLineData
f2f0dfed
JM
1#ifndef _FILESTREAM_H_
2#define _FILESTREAM_H_
3
4#include "StreamOutput.h"
5#include "stdlib.h"
6
7class FileStream : public StreamOutput {
8 public:
9 FileStream(const char *filename) { fd= fopen(filename, "a"); }
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
14 private:
15 FILE *fd;
16};
17
18#endif