diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2021-12-27 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2022-03-18 15:35:13 +0500 |
commit | f19f813537c7aea1c20749c914e756b54a9c3cf5 (patch) | |
tree | 816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /CPP/Common/StdInStream.h | |
parent | 98e06a519b63b81986abe76d28887f6984a7732b (diff) | |
download | 7zip-21.07.tar.gz 7zip-21.07.tar.bz2 7zip-21.07.zip |
'21.07'21.07
Diffstat (limited to '')
-rw-r--r-- | CPP/Common/StdInStream.h | 44 |
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 | |||
11 | class CStdInStream | ||
12 | { | ||
13 | FILE *_stream; | ||
14 | bool _streamIsOpen; | ||
15 | public: | ||
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 | |||
42 | extern CStdInStream g_StdIn; | ||
43 | |||
44 | #endif | ||