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: CStdInStream()16 CStdInStream(): _stream(0), _streamIsOpen(false) {}; CStdInStream(FILE * stream)17 CStdInStream(FILE *stream): _stream(stream), _streamIsOpen(false) {}; ~CStdInStream()18 ~CStdInStream() { Close(); } 19 20 bool Open(LPCTSTR fileName) throw(); 21 bool Close() throw(); 22 23 AString ScanStringUntilNewLine(bool allowEOF = false); 24 void ReadToString(AString &resultString); 25 UString ScanUStringUntilNewLine(); 26 27 bool Eof() throw(); 28 int GetChar(); 29 }; 30 31 extern CStdInStream g_StdIn; 32 33 #endif 34