OSF DCE Application Development Guide--Core Components

OSF DCE Application Development Guide—Core Components
3.3.1 Message Output Routines
The six message output routines in this group essentially reproduce the functionality of
printf(), fprintf( ), and sprintf(), with the difference being that they operate on a
specified message rather than on a string variable. The routines can be called without
any special preparation (but see the descriptions of the three dce_pgm_ routines).
dce_fprintf()
Retrieves the message text associated with the specified message ID, and
prints the message and its arguments on the specified stream. The
message is printed without a concluding newline; if a newline is desired
at the end of the message, then it should be coded (as \n) in the message
definition in the sams file.
The routine determines the correct message catalog and, if neccessary,
opens it. If the message catalog is inaccessible, and the message exists
in an in-memory table, then this message (the default message) is
printed. If for any reason the message cannot be retrieved, an error
message is printed.
dce_printf( )
Performs a dce_fprintf( ) of the specified message to standard output.
dce_sprintf()
Retrieves the message text associated with the specified message ID, and
writes the message and its arguments into an allocated string (which
should be freed by the caller). The routine determines the correct
message catalog and, if neccessary, opens it. If the message catalog is
inaccessible, and the message exists in an in-memory table, then this
message (the default message) is printed. If for any reason the message
cannot be retrieved, an error message is printed.
For example, assume that the following message is defined in an
application’s sams file:
start
code arg_msg
text "This message has exactly %d not %d argument(s)"
action "None required"
explanation "Test message with format arguments"
end
3 10 Tandem Computers Incorporated 124245