Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

This has been bothering me for quite a while now ... 1

Status
Not open for further replies.

BobbaFet

Programmer
Feb 25, 2001
903
0
0
NL
Hi all,

I while ago I wanted to make an array which I could
access with an integer to get a pchar, but I couldnt
get it to work (I have already solved this, but I still
think my original thought should have worked).

This is what I tried:

var Letters: array[0..25] of PChar = ['A'..'Z'];

Why didnt it work like this ??? I looked it up in the
help and it said it could be done, but all I get is an
error saying that TArray and Set are not compatible ...

Thanks allot, [bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
Because a set cannot be directly assigned to an Pchar array. The array is looking for a PChar to go in each slot not a set of characters.
 
Try this

procedure TForm7.Button1Click(Sender: TObject);
const
Letters: array[0..25] of Char ='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var
P : PChar;
begin
P := Letters[???];

{In here you can manipulate the Letters array and the PChar in any way you want}

end;
 
Hey thanks allot Erik !!!

I knew I'm not entirely stupid !!! ;-) [bobafett] BobbaFet [bobafett]

Everyone has a right to my opinion.
E-mail me at caswegkamp@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top