Board index » delphi » How to convert STRING VARIABLE into PChar?!

How to convert STRING VARIABLE into PChar?!

I am trying to convert this into a pchar:

message: pchar;
number: integer;

message := 'Number of visiters: ' + IntToStr(number);

HELLLLLPPPPPPPPPPP!

PETOR

 

Re:How to convert STRING VARIABLE into PChar?!


Quote
>I am trying to convert this into a pchar:

>message: pchar;
>number: integer;

>message := 'Number of visiters: ' + IntToStr(number);

>HELLLLLPPPPPPPPPPP!

>PETOR

Use this:
message:=pchar('number of visitors: '+IntToStr(number));

Trav

Re:How to convert STRING VARIABLE into PChar?!


message := PChar( 'Number of visiters: ' + IntToStr(number) );

--
Delphi Tips:
http://www.chamisplace.com/tips/i.asp?c=D

Quote
Piotr wrote in message <3512ceb6.889...@news.snafu.de>...
>I am trying to convert this into a pchar:

>message: pchar;
>number: integer;

>message := 'Number of visiters: ' + IntToStr(number);

>HELLLLLPPPPPPPPPPP!

>PETOR

Re:How to convert STRING VARIABLE into PChar?!


Piotr <Pe...@berlin.snafu.de> wrote in article
<3512ceb6.889...@news.snafu.de>...

Quote
> I am trying to convert this into a pchar:

> message: pchar;
> number: integer;

> message := 'Number of visiters: ' + IntToStr(number);

There are at least two ways: use a typecast, like MyPchar :=
PChar(MyString), where MyString is a long string. Or you can use the
StrPCopy function.

Wim

Other Threads