44 <<
"Cannot read file " << ifs.
name() <<
nl 51 string buf(
size_t(80),
'\0');
52 iss.read(&buf[0], 80);
57 buf.erase(iss.gcount());
61 const auto endp = buf.find(
'\0');
62 if (endp != std::string::npos)
104 std::streamsize
count 117 auto& iss = stdStream();
120 value.resize(80,
'\0');
121 iss.read(&value[0], 80);
128 value.erase(iss.gcount());
132 auto endp = value.find(
'\0');
134 if (endp != std::string::npos)
140 endp = value.find_last_not_of(
" \t\f\v\n\r");
142 if (endp != std::string::npos)
144 value.erase(endp + 1);
150 while (value.empty() && !eof())
168 reinterpret_cast<char*>(&ivalue),
174 stdStream() >> ivalue;
189 reinterpret_cast<char*>(&value),
195 stdStream() >> value;
211 reinterpret_cast<char*>(&fvalue),
217 stdStream() >> fvalue;
A class for handling file names.
ensightReadFile(const ensightReadFile &)=delete
No copy construct.
bool contains(char c) const noexcept
True if string contains given character (cf. C++23)
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
constexpr char nl
The newline '\n' character (0x0a)
virtual std::istream & stdStream()
Access to underlying std::istream.
static IOstreamOption::streamFormat detectBinaryHeader(const fileName &pathname)
Detect if the file is binary by testing for initial "(C|Fortran) Binary".
bool read(const char *buf, int32_t &val)
Same as readInt32.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
virtual Istream & read(token &)=0
Return next token from stream.
A variant of IFstream with specialised read() for strings, integers and floats. Correctly handles bin...
Istream & readBinaryHeader()
Read "C Binary" for binary files (eg, geometry/measured)
Input from file stream, using an ISstream.
virtual Istream & readKeyword(string &key)
Read element keyword.
word format(conversionProperties.get< word >("format"))
virtual const fileName & name() const
Read/write access to the name of the stream.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
bool good() const noexcept
True if next operation might succeed.
virtual Istream & read(char *buf, std::streamsize count)
Binary read.
streamFormat
Data format (ascii | binary)