From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,2afd440a210c7fb0 X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,df8a3dc583bf1f5f X-Google-Attributes: gid1164f8,public From: thomasgd@omc.bt.co.uk (Greg Thomas) Subject: Re: Compaq prefers Alpha over Merced! BUT OF COURSE, ALPHA * Date: 1998/09/01 Message-ID: <35eba975.314973147@news.axion.bt.co.uk>#1/1 X-Deja-AN: 386712579 Content-Transfer-Encoding: 7bit References: <0095000017115526000002L062*@MHS> <6rukse$3q0$1@usenet01.srv.cis.pitt.edu> <6s17hi$2g8@post.gsfc.nasa.gov> <6s4o0o$q31@news1.panix.com> <6s6i11$jla$1@vixen.cso.uiuc.edu> <35fbd212.2154018254@news.axion.bt.co.uk> <6s7hcd$sgs@gap.cco.caltech.edu> Content-Type: text/plain; charset=us-ascii Organization: BT Labs, Martlesham Heath, Ipswich, UK Mime-Version: 1.0 Newsgroups: comp.os.vms,comp.sys.dec On 29 Aug 1998 00:18:21 GMT, mathog@seqaxp.bio.caltech.edu wrote in article <6s7hcd$sgs@gap.cco.caltech.edu>: > Better would be: > >typedef struct >{ > unsigned int storage_length; > unsigned int length; > void *string_ptr; >} pascal_string_t; > ... >Unfortunately, null terminated strings permeate the libraries, so that you >would probably have to resort to making all such strings one character >longer than they would overwise be (storage_length - 1) so that you can pop >a '\0' onto the end before calling printf (or whatever). ... Not necessarily. You could use, for example printf( "%.*s", string.length, string.string_ptr ); which will only display a maximum of string.length characters. Of course you then get into the debate of what happens if there is a NULL in the 'middle' of the string, so you might be better re-writing the printf() functions with your own to take this behaviour into account. Greg -- This post represents the views of the author and does not necessarily accurately represent the views of BT.