OpenersNotesSection(Spacer1)Details

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

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

WSLogFileNameForLink() is declared in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)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 */ }

	WSActivate(link);

	/* ... */

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

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

	WSReleaseLogFileNameForLink(link, logFileName);

	/* ... */

	WSClose(link);
	WSDeinitialize(env);

	return 0;
}

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

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Lists, paclet:guide/WSTPCFunctionsForExchangingLists])}})}})