aboutsummaryrefslogtreecommitdiff
path: root/CPP/Common/StdInStream.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CPP/Common/StdInStream.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/CPP/Common/StdInStream.h b/CPP/Common/StdInStream.h
new file mode 100644
index 0000000..71578eb
--- /dev/null
+++ b/CPP/Common/StdInStream.h
@@ -0,0 +1,44 @@
1// Common/StdInStream.h
2
3#ifndef __COMMON_STD_IN_STREAM_H
4#define __COMMON_STD_IN_STREAM_H
5
6#include <stdio.h>
7
8#include "MyString.h"
9#include "MyTypes.h"
10
11class CStdInStream
12{
13 FILE *_stream;
14 bool _streamIsOpen;
15public:
16 int CodePage;
17
18 CStdInStream(FILE *stream = NULL):
19 _stream(stream),
20 _streamIsOpen(false),
21 CodePage(-1)
22 {};
23
24 ~CStdInStream() { Close(); }
25
26 bool Open(LPCTSTR fileName) throw();
27 bool Close() throw();
28
29 // returns:
30 // false, if ZERO character in stream
31 // true, if EOF or '\n'
32 bool ScanAStringUntilNewLine(AString &s);
33 bool ScanUStringUntilNewLine(UString &s);
34 // bool ReadToString(AString &resultString);
35
36 bool Eof() const throw() { return (feof(_stream) != 0); }
37 bool Error() const throw() { return (ferror(_stream) != 0); }
38
39 int GetChar();
40};
41
42extern CStdInStream g_StdIn;
43
44#endif