The following example illustrate the XPlat libraries. For additional examples, see NLM and NetWare Libraries for C.
NOTE: taken from NWHELLO.C in the \EXAMPLES directory
/*********************************************************************
NWHELLO.C
*********************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <ntypes.h>
#include <nwcaldef.h>
#include <nwapidef.h>
#include <nwclxcon.h> /* NWCCGetPrimConnRef */
#include <nwmisc.h> /* NWCallsInit */
#ifndef N_PLAT_NLM
NWCCODE ccode;
nuint32 connRef;
NWCCConnInfo returnInfo;
#endif
int main(void)
{
printf("\n Hello World!");
/* If this example is running as a client application (and not an
NLM), perform a simple network task to determine if the
environment is set up correctly. Print the server name
corresponding to the workstation’s primary connection */
#ifndef N_PLAT_NLM
/* Initialize libraries */
ccode = NWCallsInit(NULL, NULL);
if(ccode)
{
printf("\nNWCallsInit returned %04X", ccode);
exit(1);
}
/* Find the workstation’s primary connection reference. */
ccode = NWCCGetPrimConnRef(&connRef);
if(ccode)
{
printf("\nNWCCGetPrimConnRef returned %04X",ccode);
exit(1);
}
/* Get information about the primary connection. */
ccode = NWCCGetAllConnRefInfo(connRef, NWCC_INFO_VERSION,
&returnInfo);
if(ccode)
{
printf("\nNWCCGetAllConnRefInfo returned %04X",ccode);
exit(1);
}
/* print the primary connection server name. */
printf("\n\n You are attached to server %s\n\n",
returnInfo.serverName);
#endif
return(0);
}