From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,2e7cacc0c404d644 X-Google-Attributes: gidf7344,public X-Google-Thread: fc7fa,2e7cacc0c404d644 X-Google-Attributes: gidfc7fa,public From: hoffman@xdelta.enet.dec.com (Stephen Hoffman) Subject: Re: Trying to use SYS$ASSIGN... Date: 1995/12/13 Message-ID: <4an4al$ho0@nntpd.lkg.dec.com>#1/1 X-Deja-AN: 121835878 distribution: world references: organization: Digital Equipment Corp reply-to: hoffman@xdelta.enet.dec.com (Stephen Hoffman) newsgroups: comp.os.vms,comp.sys.vms In article , "Carl J. Lambrecht" writes: .. :The bit of code which appears to be having a problem is the following: : :unsigned short gsock_in; :int Status; :static struct {int Size; char *Ptr;} Descr={9,"SYS$INPUT"}; : :Status = SYS$ASSIGN(&Descr, &gsock_in, 0, 0); :if (!(Status&1)) { : exit(Status); :} : :This bit of code seems to consistently give the error of "no device or :address"... You will want to take a look at the C documentation around the declaration and use of the string descriptor structure. I've added a colon to the device, I've switched to the $DESCRIPTOR macro (use of the dsc$descriptor structure would have worked), I've changed to the correct case -- lowercase -- for the call to the sys$assign() routine, I've added a few include files, and I've switched over to the status check macro $VMS_STATUS_SUCCESS. I've also changed a few variable names to reflect their use... -- #include #include #include unsigned short int InputChan; int Status; $DESCRIPTOR( InputDevDescr, "SYS$INPUT:" ); Status = sys$assign( &InputDevDescr, &InputChan, 0, 0); if (!$VMS_STATUS_SUCCESS( Status )) return Status; -- If you choose to use a string descriptor and are manually initializing it, you will want to use the descriptor class DSC$K_CLASS_S until you fully understand the declaration and use of the dynamic string descriptor class DSC$K_CLASS_D. And most common string descriptors use the text string data type: DSC$K_DTYPE_T. (These values, and the structure of various string descriptors are declared in descrip.h.) -- I strongly recommend taking a look at the DEC C manuals, as they cover various topics related to the use of DEC C on OpenVMS. (If you are still using VAX C, seriously consider upgrading to DEC C.) ------------------------------ Opinionative ------------------------------- Stephen Hoffman OpenVMS Engineering hoffman@xdelta.enet.dec.com Insunt interdum menda in eo quod est efficax ---------------------------------------------------------------------------