Skip to Main Content Skip to Search
Product Documentation

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 string 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++

Example

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

See Also

ssWarning


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

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS