39 char *endptr =
nullptr;
41 const intmax_t parsed = ::strtoimax(buf, &endptr, 10);
43 const int val = int(parsed);
47 (parsed < INT_MIN || parsed > INT_MAX)
48 ? parsing::errorType::RANGE
49 : parsing::checkConversion(buf, endptr)
52 if (err != parsing::errorType::NONE)
55 << parsing::errorNames[err] <<
" '" << buf <<
"'"
65 char *endptr =
nullptr;
67 const intmax_t parsed = ::strtoimax(buf, &endptr, 10);
73 (parsed < INT_MIN || parsed > INT_MAX)
75 : (parsing::checkConversion(buf, endptr) == parsing::errorType::NONE)
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
errorType
Enumeration for possible parsing error.
int readInt(Istream &is)
Read int from stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)