This feature is not supported on the Wolfram Cloud.

int WSLogFileNameForLink(WSLINK l, const char **name)
computes a suitable name and (optionally) a location in the file system for a log file to log the WSTP data stream in the WSTP connection specified by l and stores the name in name.


  • WSLogFileNameForLink() allocates memory for the name of the log file that must be released by calling WSReleaseLogFileNameForLink(). If WSLogFileNameForLink() fails and returns an error, do not use WSReleaseLogFileNameForLink() to release the contents of name.
  • WSLogFileNameForLink() returns 1 on success and 0 on failure.
  • WSLogFileNameForLink() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

int main(int argc, char **argv)
    WSENV env;
    WSLINK link;
    int error;
    const char *logFileName;
    int apiResult;

    env = WSInitialize((WSEnvironmentParameter)0);
    if(env == (WSENV)0)
    { /* Unable to create WSTP environment object */ }

    link = WSOpenArgcArgv(env, argc, argv, &error);
    if(link == (WSLINK)0 || error != WSEOK)
    { /* Unable to create link object */ }


    /* ... */

    apiResult = WSLogFileNameForLink(link, &logFileName);
    if(! apiResult =)
    { /* Unable to generate a file name */ }

    apiResult = WSLogStreamToFile(link, logFileName);
    { /* unable to log to logFileName */ }

    WSReleaseLogFileNameForLink(link, logFileName);

    /* ... */


    return 0;