From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM"  5-MAY-1993 14:19:43.36
To:	EVERHART
CC:	
Subj:	RE: Implementing VMS mailboxes

Date: Wed, 05 May 1993 10:37:09 EDT
From: Mighty Firebreather <dragon@nscvax.princeton.edu>
To: jim@kn5f.jsc.nasa.gov
CC: info-vax@sri.com
Message-ID: <0096C0B9.B2167F60.18625@nscvax.princeton.edu>
Subject: RE: Implementing VMS mailboxes

	J. Dickerson <jim@kn5f.jsc.nasa.gov> writes:
>
>We're trying to implement VMS mailboxes in C but having a problem getting them
>to work. We have experience doing it in Ada and we've read the VMS I/O User's
>Reference and  the Introduction to VMS System Services but still can't get it
>to work.
>If anyone out there has example code in C or other information that they would
>like to share with us,  we'd appreciate hearing from you at the above address.
>

	"... but we still can't get it to work." is not a particularly 
useful problem description!  What, exactly, are you having trouble with?
What did you actually do and what happened when you did it?

	Here is sample C code to create a mailbox.  (I think Jean Henchey 
wrote it, I just fixed it.)  You will note that this code doesn't actually
*do* anything with the mailbox; it just creates it and lets it die after 30
seconds.

#include	<starlet.h>
#include	<descrip.h>
#include	<ssdef.h>
#include	<psldef.h>

int main()
{
	long return_status;
	char prmflg=0;	/* Temporary mailbox, 1 to make permanent */
	int chan;	/* Will hold the channel number */
	unsigned long maxmsg=0;	/* Use the default size */
	unsigned long bufquo=0; /* Use the default */
	unsigned long promsk=0;	/* Allow LPWR to S,O,G,W */
	unsigned long acmode=PSL$C_USER;
	$DESCRIPTOR (logdescr, "A_LOGICAL_NAME");

	return_status = sys$crembx(prmflg, &chan, maxmsg, bufquo, promsk,
		acmode, &logdescr);
	if (return_status != SS$_NORMAL) lib$stop(return_status);
	sleep(30);	/* Take a few moments to admire our new mailbox */
	exit(0);	/* If nobody has opened a channel to the mailbox
			   it will disappear now. */
}


*************************************************************************
*                                                                       *
*                        Here, there be dragons!                        *
*                      dragon@nscvax.princeton.edu                      *
*                                                                       *
*                                                Richard B. Gilbert     *
*************************************************************************

