VMS C & records in files

Leo de Wit leo at philmds.UUCP
Tue Aug 23 19:56:13 AEST 1988


In article <966 at nmtsun.nmt.edu> warner at hydrovax.nmt.edu (M. Warner Losh) writes:
|It has been my experience you only need to build descriptors whenever you
|are playing with strings.  Everything else is simply a matter of maybe
|putting a & in front of what you want to call.  You can make your life
|a lot easier if you use the following function (DEC, why didn't you provide
|this?):
|
|#include <stdio.h>
|#include <descrip.h>
|
|struct dsc$descriptor * make_descriptor(st)
|char *st;
|{
   [body discarded]...
|}

Don't know which version of VMS C you're using, but this is from
descrip.h on our system, the last 5 lines (maybe you overlooked them):

/*
 *	A simple macro to construct a string descriptor:
 */
#define $DESCRIPTOR(name,string)	struct dsc$descriptor_s name = { sizeof(string)-1, DSC$K_DTYPE_T, DSC$K_CLASS_S, string }

Note that this deals with removal of the declared object as well (no need for
free). The initialization of an auto struct may not be portable, but then: who
cares; neither is the stupid use of $ in names.
So you can throw your function overboard now 8-).

                                          Leo.



More information about the Comp.lang.c mailing list