This example shows how to create and free a character attribute object.

#include <stdio.h>
#include <unidef.h>

int main(void) {

LocaleObject locale_object = NULL;
AttrObject   attr_object = NULL;
int          rc = ULS_SUCCESS;

         /*****************************************************************/
         /* Assumes LANG environment variable set to a valid locale name, */
         /* such as fr_FR                                              */
         /*****************************************************************/

         rc = UniCreateLocaleObject(UNI_UCS_STRING_POINTER,
                                   (UniChar *)L"", &locale_object);

         if (rc != ULS_SUCCESS) {
           printf("UniCreateLocaleObject error: return code = %u\n", rc);
           return 1;
         }

         /* Create an alphabetic attribute object */

         rc = UniCreateAttrObject(locale_object,
                                 (UniChar *)L"alpha", &attr_object);

         if (rc != ULS_SUCCESS) {
           printf("UniCreateAttrObject error: return code = %u\n", rc);
           return 1;
         }

         /* Free the character attribute object */

         rc = UniFreeAttrObject(attr_object);

         if (rc != ULS_SUCCESS) {
           printf("UniFreeAttrObject error: return code = %u\n", rc);
           return 1;
         }

         return ULS_SUCCESS;


}


[Back: UniFreeAttrObject - Related Functions]
[Next: UniFreeAttrObject - Topics]