SplPurgeQueue - Example Code

This code will purge a local queue, whose name 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 *arg[];
{
   SPLERR splerr ;
   PSZ    pszComputerName = NULL ;
   PSZ    pszQueueName ;

   /* Get queue name from the input argument.                                 */
   pszQueueName = arg[1];

   /* Call the function to do the purge. If an error is returned, print it.   */
   splerr=SplPurgeQueue(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 purged.\n",pszQueueName);
   } /* endif */

  DosExit( EXIT_PROCESS , 0 ) ;
  return (splerr);
}


[Back: SplPurgeQueue - Related Functions]
[Next: SplPurgeQueue - Topics]