OpenersNotesSection(Spacer1)Details

MLLogFileNameForLink() allocates memory for the name of the log file that must be released by calling (NonWLLink[MLReleaseLogFileNameForLink(), paclet:/ref/c/MLReleaseLogFileNameForLink]). If MLLogFileNameForLink() fails and returns an error, do not use (NonWLLink[MLReleaseLogFileNameForLink(), paclet:/ref/c/MLReleaseLogFileNameForLink]) to release the contents of name.

MLLogFileNameForLink() returns 1 on success and 0 on failure.

MLLogFileNameForLink() is declared in the MathLink header file (RefLink[mathlink.h, paclet:/ref/file/mathlink.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "mathlink.h"

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

	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, &logFileName);
	if(! apiResult =)
	{ /* Unable to generate a file name */ }

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

	MLReleaseLogFileNameForLink(link, logFileName);

	/* ... */

	MLClose(link);
	MLDeinitialize(env);

	return 0;
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLReleaseLogFileNameForLink(), paclet:/ref/c/MLReleaseLogFileNameForLink])  ▪  (NonWLLink[MLLogStreamToFile(), paclet:/ref/c/MLLogStreamToFile])}})}})