Using the C Math Library | ![]() ![]() |
Defining a Print Handler
In the past, when there were only character-based terminals, input and output were very simple; programs used scanf
for input and printf
for output. Graphical user interfaces (GUIs) make input and output routines more complex. The MATLAB C Math Library is designed to run on both character-based terminals and in graphical, windowed environments. Simply using printf
or a similar routine is fine for character-terminal output, but insufficient for output in a graphical environment.
The MATLAB C Math Library performs some output; in particular it displays error messages and warnings, but performs no input. To support programming in a graphical environment, the library allows you to determine how the library displays output.
The MATLAB C Math Library's output requirements are very simple. The library formats its output into a character string internally, and then calls a function that prints the single string. If you want to change where or how the library's output appears, you must provide an alternate print handler.
![]() | Replacing the Default Library Error Handler | Providing Your Own Print Handler | ![]() |