XLL+ Class Library

COper::ReadOpt

Reads an optional argument from an OPER, optionally using a default for omitted arguments

[C++]
int ReadOpt(
   bool& result,
   bool defaultValue
);
int ReadOpt(
   double& result,
   double defaultValue
);
int ReadOpt(
   CString& result,
   const char* defaultValue
);
int ReadOpt(
   USHORT& result,
   USHORT defaultValue
);
int ReadOpt(
   short& result,
   short defaultValue
);
int ReadOpt(
   long& result,
   long defaultValue
);

Parameters

result

If an appropriate value is found, then it is converted to the output type and placed in the variable referenced by this parameter.

If the value is missing or empty, then the default value will be used.

If the argument cannot be converted, then the output variable will not be affected.

defaultValue

If the value is missing or empty, then the default value will be copied to the output value. Otherwise the default is not used.

Return value

This function returns -1, 0 or 1 as follows:

-1The argument was of an unexpected type and could not be read.
0The argument was missing or empty, and the default value was used.
1The argument was present and correct.

Example

COper::ReadOpt() Examples

Requirements

Header: xllplus.h

See Also

COper Class | COper Methods