This sample code will release the local queue that is entered at the prompt.
#define INCL_SPL
#define INCL_SPLERRORS
#include <os2.h>
#include <stdio.h> /* for printf function */
INT main (argc, argv)
INT argc;
CHAR *argv[];
{
SPLERR splerr ;
PSZ pszComputerName = NULL ;
PSZ pszQueueName ;
/* Get queue name from the input argument. */
pszQueueName = argv[1];
/* Call the function to do the release. If an error is returned, print it. */
splerr=SplReleaseQueue(pszComputerName, pszQueueName);
if (splerr != 0L)
{
switch (splerr)
{
case NERR_QNotFound:
printf("Queue does not exist.\n");
break;
case NERR_SpoolerNotLoaded:
printf("The Spooler is not running.\n");
break;
default:
printf("Errorcode = %ld\n",splerr);
} /* endswitch */
}
else
{
printf("Queue %s was released.\n",pszQueueName);
} /* endif */
DosExit( EXIT_PROCESS , 0 ) ;
return (splerr);
}