MLLogStreamToFile (C Function)

MLLogStreamToFile has been replaced by WSLogStreamToFile.

int MLLLogStreamToFile ( MLINK l , const char * f )

turns on logging of the MathLink connection specified by l and logs the contents of the stream to the file specified in f.

Details

  • The user must have permission to write to the file specified in f.
  • You can send the log of the same stream to more than one file. Call MLLogStreamToFile() again with a different file name to log to another file.
  • Do not call MLLogStreamToFile() prior to calling MLActivate() or MLConnect().
  • MLLogStreamToFile() returns 0 on failure and a nonzero value on success.
  • MLLogStreamToFile() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

int main(int argc, char **argv)
{
    MLENV env;
    MLINK link;
    int error;
    int apiResult;
    const char *fileName;

    env = MLInitialize((MLEnvironmentParameter)0);
    if(env == (MLENV)0)
    { /* Unable to create MathLink environment object */ }

    link = MLOpenArgcArgv(env, argc, argv, &error);
    if(link == (MLINK)0 || error != MLEOK)
    { /* Unable to create link object */ }

    MLActivate(link);

    /* ... */

    apiResult = MLLogFileNameForLink(link, &fileName);
    if(! apiResult)
    { /* Unable to generate log file name */ }

    apiReuslt = MLLogStreamToFile(link, fileName);
    if(! apiResult)
    { /* Unable to log stream to file */ }

    MLReleaseLogFileNameForLink(link, fileName);

    /* ... */

    MLClose(link);
    MLDeinitialize(env);
}