🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.borland
Article #181

Re: CASE in records

#181
From: Marc Griffin
Date: Tue, 13 Jun 2000 00:00
32 lines
2002 bytes
I can write the code for you quite quickly, but why would you want this
array style?

Marco van de Voort <marcov@toad.stack.nl> wrote in message
news:slrn8kbock.1i2m.marcov@toad.stack.nl...
> >>   tString = Record
> >>     Case Boolean Of
> >>       True: (AsStr :String);
> >>       False: (AsByte :Byte; AsChar :Array[0..253] Of Char);
> >>   End;
> >
> >> In your program, you can either reference "tString.AsStr" as a string
type,
> >> or reference it as "AsByte" and "AsChar" to get the length (AsByte) and
it's
> >> contents (AsChar).  This means you can use the PChar routines on
> >> tString.AsChar (as long as you remember to update AsByte with the
string
> >> length). You can empty the string by "tString.AsStr := '';" or
> >
> >You'll also need to make sure that you write a terminating #0 byte each
time
> >you modify the string, if you want to use it with PChar routines.
>
> Now we are on this topic, does somebody have a unit for modula2 styled
> array of char ?
>
> This is zero terminated, except when the array is full (then length is
> sizeof/high(x)), which allows the last char to be used for text.
>
>
>
Technical Details
Message-ID: <7Gn15.23769$J5.350175@stones>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3933FF8D.FFBE7575@vgrieken.demon.nl> <Qjx05.11645$J5.281761@stones> <8i47bi$in1$1@enyo.uwa.edu.au> <slrn8kbock.1i2m.marcov@toad.stack.nl>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111659,60a819bd5bee7e02
X-Google-Attributes: gid111659,public
X-Google-Thread: 108ebd,60a819bd5bee7e02
X-Google-Attributes: gid108ebd,public
From: "Marc Griffin" <cannonfod@earthling.net>
Subject: Re: CASE in records
Date: 2000/06/13
Message-ID: <7Gn15.23769$J5.350175@stones>
X-Deja-AN: 633915547
References: <3933FF8D.FFBE7575@vgrieken.demon.nl> <Qjx05.11645$J5.281761@stones> <8i47bi$in1$1@enyo.uwa.edu.au> <slrn8kbock.1i2m.marcov@toad.stack.nl>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-Complaints-To: abuse@plus.net.uk
X-Trace: stones 960890627 212.56.119.131 (Tue, 13 Jun 2000 11:03:47 BST)
X-MSMail-Priority: Normal
NNTP-Posting-Date: Tue, 13 Jun 2000 11:03:47 BST
Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal