SplCreateQueue - Example Code

This sample code creates a queue on the local workstation. The queue is created with dummy parameters. The name is entered at the command line.

#define INCL_BASE
#define INCL_SPL
#define INCL_SPLDOSPRINT

#include <os2.h>
#include <stdio.h>
#include <string.h>

INT main (argc, argv )
    INT argc;
    CHAR *argv[];
{

    ULONG  splerr  ;
    ULONG  cbBuf;
    ULONG  ulLevel ;
    PSZ    pszComputerName ;
    PSZ    pszQueueName ;
    PRQINFO3 prq3  ;

    if (argc != 2)
    {
       printf("Syntax:  sqcrt  QueueName \n");
       DosExit( EXIT_PROCESS , 0 ) ;
    }

    pszComputerName = (PSZ)NULL ;
    ulLevel = 3L;

    /* Get the queue name from the argument entered at    */
    /* the command line.                                  */
    pszQueueName = argv[1];

    /* Determine the size of the needed buffer.           */
    cbBuf = sizeof(PRQINFO3);

    /* Set up the structure with some dummy parameters.   */
    prq3.pszName = pszQueueName;
    prq3.uPriority=5;
    prq3.uStartTime=0;
    prq3.uUntilTime=0;
    prq3.pszSepFile="c:\\os2\\sample.sep";
    prq3.pszParms=NULL;
    prq3.pszPrinters=NULL;
    prq3.pszDriverName=NULL;
    prq3.pDriverData="IBMNULL";      /* Set to Driver.Device name */

    /* Make the call with the proper parameters.                   */
    splerr = SplCreateQueue(pszComputerName, ulLevel,
                            &prq3, cbBuf);

    /* Print out the error return code and some other information. */
    printf("SplCreateQueue Error=%ld, cbNeeded=%ld\n",
            splerr, cbBuf) ;

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


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