This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

engOutputBuffer (C and Fortran)

Specify buffer for MATLAB output

C Syntax

#include "engine.h"
int engOutputBuffer(Engine *ep, char *p, int n);

Fortran Syntax

#include "engine.h"
integer*4 engOutputBuffer(ep, p)
mwPointer ep
character*n p



Engine pointer


Pointer to character buffer


Length of buffer p


1 if you pass it a NULL engine pointer. Otherwise, returns 0.


engOutputBuffer defines a character buffer for engEvalString to return any output that ordinarily appears on the screen.

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);

To turn off output buffering in Fortran, use:

engOutputBuffer(ep, '')


The buffer returned by engEvalString is not NULL terminated.


See these examples in matlabroot/extern/examples/eng_mat:

  • engdemo.c for a C example on UNIX® operating systems.

  • engwindemo.c for a C example on Microsoft® Windows® operating systems.

Introduced before R2006a