Main Content

ssPrintf

Print a variable-content message

Syntax

int_T ssPrintf(const char_T *msg, ...)

Arguments

msg

Message. Must be a ANSI®1 C printf-style character vector with optional variable replacement parameters.

...

Optional replacement arguments.

Returns

A positive value indicating the number of bytes transmitted. Returns a negative number indicating an error.

Description

Prints a variable-content msg. This macro expands to mexPrintf when the S-function is compiled via mex for use in a Simulink® simulation. When the S-function is compiled for use with the Simulink Coder™ code generation, this macro expands to printf if the target has stdio facilities; otherwise, it becomes a call to an empty function (rtPrintfNoOp). In the case of code generation, you can avoid a call altogether, using the SS_STDIO_AVAILABLE macro defined by simstruc.h. For example:

#if defined(SS_STDIO_AVAILABLE)
	ssPrintf("my message ...");
#endif

Languages

C, C++

Examples

See the S-function sfun_atol.c used in sfcndemo_sfun_atol.

See Also

ssWarning

Version History

Introduced before R2006a


1 ANSI is a registered trademark of the American National Standards Institute, Inc.