MCPcopy Create free account
hub / github.com/CobaltFusion/DebugViewPP / ReadUntilEof

Method ReadUntilEof

DebugView++Lib/BinaryFileReader.cpp:89–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void BinaryFileReader::ReadUntilEof()
90{
91 std::wstring line;
92 while (std::getline(m_wifstream, line))
93 AddLine(Str(line));
94
95 if (m_wifstream.eof())
96 {
97 m_wifstream.clear(); // clear EOF condition
98
99 // resync to end of file, even if the file shrunk
100 auto lastReadPosition = m_wifstream.tellg();
101 m_wifstream.seekg(0, m_wifstream.end);
102 auto length = m_wifstream.tellg();
103 if (length > lastReadPosition)
104 m_wifstream.seekg(lastReadPosition);
105 else if (length != lastReadPosition)
106 AddInternal(stringbuilder() << "file shrank, resynced at offset " << length);
107 }
108 else
109 {
110 // Some error other then EOF occured
111 AddInternal("Stopped tailing " + Str(m_filename).str());
112 m_end = true;
113 }
114}
115
116void BinaryFileReader::AddLine(const std::string& line)
117{

Callers

nothing calls this directly

Calls 3

StrClass · 0.85
eofMethod · 0.80
strMethod · 0.45

Tested by

no test coverage detected