OSF DCE Application Development Guide--Core Components
OSF DCE Application Development Guide—Core Components
The following code fragment shows how dce_msg_cat_open( ) might be
called to open the message catalog containing the ‘‘Hello World’’
message defined for the example application earlier in this chapter:
#include <dce/dce.h>
#include <dce/dce_msg.h>
#include "dcehelmsg.h"
dce_msg_cat_handle_t hel_msg_handle;
unsigned32 status;
<. . .>
hel_msg_handle = dce_msg_cat_open(hello_msg, &status);
dce_msg_cat_get_msg()
(DCE abstraction over catgets()) Retrieves a message from
an open catalog. If the message is not available, returns
NULL.
The routine will fail if the message catalog is not installed or if LANG is
not properly set.
The following code fragment shows how dce_msg_cat_get_msg( )
might be called to retrieve the ‘‘Hello World’’ message. Note that the
message catalog must first be opened.
#include <dce/dce.h>
#include <dce/dce_msg.h>
#include "dcehelmsg.h"
dce_msg_cat_handle_t hel_msg_handle;
unsigned32 status;
unsigned_char_t *msg;
<. . .>
hel_msg_handle = dce_msg_cat_open(hello_msg, &status);
msg = (unsigned_char_t *)dce_msg_cat_get_msg(hel_msg_handle,
hello_msg,
&status);
printf("Message from dce_msg_cat_get_msg == %s\n", msg);
dce_msg_get_cat_msg()
Convenience form of previous routine. Opens a message
catalog, extracts a message identified by a global message
ID, and returns a pointer to malloc()’d space containing the
message. If the message catalog is inaccessible, returns an
error.
3− 16 Tandem Computers Incorporated 124245