3.7.1. Message

The Message macro is a utility that displays data to the console in a format that you specify.

int Message(char *format,...);

The first argument in the Message macro is the format string. It specifies how the remaining arguments are to be displayed in the console. The format string is defined within quotes. The value of the replacement variables that follow the format string will be substituted in the display for all instances of %type. The % character is used to designate the character type. Some common format characters are: %d for integers, %f for floating point numbers, %g for double data type, and %e for floating point numbers in exponential format (with e before the exponent). Consult a C programming language manual for more details. The format string for Message is similar to printf, the standard C I/O function (see Standard I/O Functions for details).

In the example below, the text Volume integral of turbulent dissipation: will be displayed in the console, and the value of the replacement variable, sum_diss, will be substituted in the message for all instances of %g.

Example:

 Message("Volume integral of turbulent dissipation: %g\n", sum_diss);
  /* g represents floating point number in f or e format */
  /* \n denotes a new line */ 

Important:  It is recommended that you use Message instead of printf in compiled UDFs.



Release 18.2 - © ANSYS, Inc. All rights reserved.