This SHOULD NOT work in BP or any flavor of Pascal, any more than the following should work:
const Digit: array[0..255] of 0..9 = 123456789101112;
A string is a different data type than an array of char, with a lot of different methods.
I am surprised tht BP identifies short arrays of char with short strings.
Would (and should) this work?
program foo;
var ch1, ch2, ch3: array[1..100] of char;
begin ch1 := '123'; ch2 := '456'; ch3 := ch1+ch2; (* or ch3 := Concat(ch1, ch2); *) Writeln(ch3, ' ', Length(ch3)); end.
I say absolutely not. HF
I tried this, and it does not compile. The Borland compiler will not allow ch1 := '123'; Assigning a string value to a character array is a shortcut for initializing character arrays so that you don't have to write Const ch: array[1..100] of char = ('H', 'e', 'l', 'l', 'o'); Instead you can write Const ch: array[1..100] of char = 'Hello'; However this works only in Const clauses, and only when the size of the array elements is less than 256 characters.
If you need to initialize a character array greater than 255 chars in BP, you can resort to using absolute. For example Const ch1: array[1..5,1..100] of char = ('First 100 chars', 'Second 100 chars', ..., 'Last 100 chars'); Var ch: array[1..500] of char absolute ch1;
Frank Rubin
Contestcen@aol.com wrote:
Part 1.1 Type: Plain Text (text/plain) Encoding: 7bit
Your persistent refusal to correct your html posting forces me to consider you a troll.
Frank Rubin
-------------------------------1121921711 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable
<HTML><HEAD> <META charset=3DUS-ASCII http-equiv=3DContent-Type content=3D"text/html; cha= rset=3DUS-ASCII"> <META content=3D"MSHTML 6.00.2900.2668" name=3DGENERATOR></HEAD> <BODY style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial; BACKGROUND-COLOR: #fffff= f">
Please, throw this fellow from the mailing list.
Adriaan van Os