• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Common/StdInStream.h
2 
3 #ifndef ZIP7_INC_COMMON_STD_IN_STREAM_H
4 #define ZIP7_INC_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):
_stream(stream)19       _stream(stream),
20       // _streamIsOpen(false),
21       CodePage(-1)
22       {}
23 
24   /*
25   ~CStdInStream() { Close(); }
26 
27   bool Open(LPCTSTR fileName) throw();
28   bool Close() throw();
29   */
30 
31   // returns:
32   //   false, if ZERO character in stream
33   //   true, if EOF or '\n'
34   bool ScanAStringUntilNewLine(AString &s);
35   bool ScanUStringUntilNewLine(UString &s);
36   // bool ReadToString(AString &resultString);
37 
Eof()38   bool Eof() const throw() { return (feof(_stream) != 0); }
Error()39   bool Error() const throw() { return (ferror(_stream) != 0); }
40 
41   int GetChar();
42 };
43 
44 extern CStdInStream g_StdIn;
45 
46 #endif
47