Path: utzoo!attcan!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.lang.c Subject: Re: VMS C & records in files Summary: string descriptors are provided for Message-ID: <612@philmds.UUCP> Date: 23 Aug 88 09:56:13 GMT References: <966@nmtsun.nmt.edu> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 30 In article <966@nmtsun.nmt.edu> warner@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 |#include | |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.