FATOBOOL C-3


NAME



fatobool - convert ASCII to BOOLEAN value

SYNOPSIS



#include

int fatobool (sptr, format, b, size)
char *sptr;
char *format;
BOOLEAN *b;

int size;

DESCRIPTION



Fatobool converts a string pointed to by sptr to a BOOLEAN value
using format to control the conversion. The result of the
conversion is stored in the BOOLEAN value pointed at by b. Size
is the size of the BOOLEAN value.

A BOOLEAN format has two specifiers. If the string sptr matches
the first specifier, a TRUE (nonzero) value is stored at b. If
the string sptr matches the second specifier, a FALSE (zero)
value is stored at b. Partial matches are also considered valid.
For example, if the specifier is yes, strings of y, ye, and yes
are all valid.

Fatobool returns the number of characters in sptr used to convert
the value.

SEE ALSO



fcountry(C-3), getfbool(C-3), atobool(C-3)
C/Base Reference Manual Chapter 13, "Formatting Data Values"

DIAGNOSTICS

If an error occurs, fatobool returns a negative number and the
content of b is undefined. The following symbolic error codes are
defined in :

FTOOBIG size is not the size of a BOOLEAN value (use
sizeof function).

FFORMAT format does not contain two specifiers.

FEDIT sptr does not match either specifier in format.

NOTES



Strings are compared case insensitive (i.e., Y, YE, YES, and Yes
are also valid for the previous example).