🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: CASE in records

#179
From: The Scarlet Manuka
Date: Tue, 13 Jun 2000 00:00
26 lines
1883 bytes
Marc Griffin <cannonfod@earthling.net> wrote:
> Simply put:

> Type
>   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.

-- 
______________________________________________________________________
     The Scarlet Manuka,      |        Nitpickers' Party motto:
  Pratchett Quoter At Large,  |  "He who guards his lips guards his
 First Prophet of Bonni, is:  |  soul, but he who speaks rashly will
   sacha@maths.uwa.edu.au     |    come to ruin." -- Proverbs 13:3
______________________________|_______________________________________
Technical Details
Message-ID: <8i47bi$in1$1@enyo.uwa.edu.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3933FF8D.FFBE7575@vgrieken.demon.nl> <Qjx05.11645$J5.281761@stones>

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: sacha@maths.uwa.edu.au (The Scarlet Manuka)
Subject: Re: CASE in records
Date: 2000/06/13
Message-ID: <8i47bi$in1$1@enyo.uwa.edu.au>
X-Deja-AN: 633804503
References: <3933FF8D.FFBE7575@vgrieken.demon.nl> <Qjx05.11645$J5.281761@stones>
X-Trace: enyo.uwa.edu.au 960864434 19169 130.95.16.67 (13 Jun 2000 02:47:14 GMT)
Organization: *wibble*
User-Agent: tin/pre-1.4-971106 (UNIX) (IRIX/6.5 (IP22))
Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal
X-Complaints-To: usenet@news.uwa.edu.au