VistaIOStringConst VistaIOEncodeAttrValue (dict, repn, value)
- VistaIODictEntry *dict; VistaIORepnKind repn; type value;
- May specify a dictionary to be used in translating the value supplied to a keyword that should be returned as the encoded value, or it may be NULL
- Specifies the representation of the value to be encoded.
- Specifies the value to be encoded.
DESCRIPTIONVistaIOEncodeAttrValue takes a value and an optional dictionary, and encodes the value as a character string suitable for storage in an attribute list or output to a data file.
With the dict argument you can provide a dictionary for mapping value to a keyword that will be returned as the encoded value (see VistaIOdictionary(3)). For example, if you pass a value of 1 and a dictionary that associates the value 1 with the keyword ubyte (as the dictionaryVistaIORepnDict does), then the string ubyte will be returned. Dictionaries may be used to map both numeric values and strings to keywords. If you supply a dictionary but value is not mentioned in that dictionary, then value itself will be encoded as a string and returned.
RETURN VALUESIf successful, VistaIOEncodeAttrValue returns a string that is valid until the next VistaIOEncodeAttrValue, VistaIOSetAttr, or VistaIOSetAttrValue call. If, on the other hand, it fails because repn is not one of the representations supported, it returns NULL
- ``Can't encode from repn.''
- The repn argument is not one of VistaIOBitRepn, VistaIOUByteRepn, ..., VistaIOBooleanRepn, or VistaIOStringRepn.