🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: CASE in records

#180
From: Marco van de Voort
Date: Tue, 13 Jun 2000 00:00
20 lines
1570 bytes
>>   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: <slrn8kbock.1i2m.marcov@toad.stack.nl>
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>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 108ebd,60a819bd5bee7e02
X-Google-Attributes: gid108ebd,public
X-Google-Thread: 111659,60a819bd5bee7e02
X-Google-Attributes: gid111659,public
From: marcov@toad.stack.nl (Marco van de Voort)
Subject: Re: CASE in records
Date: 2000/06/13
Message-ID: <slrn8kbock.1i2m.marcov@toad.stack.nl>
X-Deja-AN: 633868365
References: <3933FF8D.FFBE7575@vgrieken.demon.nl> <Qjx05.11645$J5.281761@stones> <8i47bi$in1$1@enyo.uwa.edu.au>
Organization: Eindhoven University of Technology, The Netherlands
User-Agent: slrn/0.9.6.2 (FreeBSD)
Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal