7zip/CPP/Common/StdInStream.h

47 lines
887 B
C
Raw Normal View History

2021-12-27 01:00:00 +01:00
// Common/StdInStream.h
2023-06-21 02:00:00 +02:00
#ifndef ZIP7_INC_COMMON_STD_IN_STREAM_H
#define ZIP7_INC_COMMON_STD_IN_STREAM_H
2021-12-27 01:00:00 +01:00
#include <stdio.h>
#include "MyString.h"
#include "MyTypes.h"
class CStdInStream
{
FILE *_stream;
2023-06-21 02:00:00 +02:00
// bool _streamIsOpen;
2021-12-27 01:00:00 +01:00
public:
int CodePage;
CStdInStream(FILE *stream = NULL):
_stream(stream),
2023-06-21 02:00:00 +02:00
// _streamIsOpen(false),
2021-12-27 01:00:00 +01:00
CodePage(-1)
2023-06-21 02:00:00 +02:00
{}
2021-12-27 01:00:00 +01:00
2023-06-21 02:00:00 +02:00
/*
2021-12-27 01:00:00 +01:00
~CStdInStream() { Close(); }
bool Open(LPCTSTR fileName) throw();
bool Close() throw();
2023-06-21 02:00:00 +02:00
*/
2021-12-27 01:00:00 +01:00
// returns:
// false, if ZERO character in stream
// true, if EOF or '\n'
bool ScanAStringUntilNewLine(AString &s);
bool ScanUStringUntilNewLine(UString &s);
// bool ReadToString(AString &resultString);
bool Eof() const throw() { return (feof(_stream) != 0); }
bool Error() const throw() { return (ferror(_stream) != 0); }
int GetChar();
};
extern CStdInStream g_StdIn;
#endif