engOutputBuffer (C)
Specify buffer for MATLAB output
C Syntax
#include "engine.h" int engOutputBuffer(Engine *ep, char *p, int n);
Description
engOutputBuffer defines a character buffer for
engEvalString to return any output that ordinarily appears on the
screen. The function returns 1 if you pass it a
NULL engine pointer. Otherwise, returns
0.
The default behavior of engEvalString is to discard any standard
output caused by the command it is executing. A call to
engOutputBuffer with a buffer of nonzero length tells any
subsequent calls to engEvalString to save output in the character
buffer pointed to by p.
To turn off output buffering in C, use:
engOutputBuffer(ep, NULL, 0);
Note
The buffer returned by engEvalString is not
NULL terminated.
Note
matlab::engine::StreamBuffer in the MATLAB® Engine API for C++ is recommended over
engOutputBuffer. The MATLAB Engine API for C++ includes modern C++ features for writing engine
applications. For more information, see Call MATLAB from C++. There
are no plans to remove engOutputBuffer or the Engine API for
C.
Input Arguments
Examples
Display MATLAB Engine Function Output from C on Windows
This C code shows how to capture and display MATLAB output in a MATLAB C engine function on a Windows® system.
Display MATLAB Engine Function Output from C on Linux or macOS
This C code shows how to capture and display MATLAB output in a MATLAB C engine function on a Linux® or macOS system.
Version History
Introduced before R2006a
