Board index » delphi » PChar SOMEONE PLEASE HELP ME !!

PChar SOMEONE PLEASE HELP ME !!

Quote
Gary wrote:

> Hello,

> Someone please help me !  I've been messing around with the winsock
> stuff you can do in Turbo Pascal Windows, but I have come to a hault,
> it seems that the only send data I can use is of PChar form, does
> anyone know how I can make a string into PChar ? Please help I really
> am stuck. If its not possible to make string >> pchar is there some
> other way of inputting data to the computer and making it into Pchar ?

uses Strings;

var
  s : string;
  sz : array[0..256] of char;

  s:='.......whatever';
  StrPCopy(sz,s);

The above uses the extended syntax by which the compiler treats PChar and a zero-based
character array as (mostly) equivalent. This is often easier to program. Alternatively:

uses Strings;

var
  s : string;
  b : PChar;

  s:='.......whatever';
  GetMem(b,length(s)+1);
  StrPCopy(b,s);

Quote
> Please reply to me at hum...@dial.pipex.com as I don't regulary check
> USENET.

If you post questions and expect replies then you jolly well ought to check the
newsgroup.
Quote
> Thanks very much.

> Gary

 

Re:PChar SOMEONE PLEASE HELP ME !!


        {String to PChar}
        StrPCopy(aPChar,aString);
        {PChar to String}
        aString:=strpas(aPchar);

Note: both functions are in the strings unit.
--
Hilton Evans
***********************************************************
The two most important things in life are personal
health and time ... H.Evans 1995
**********************************************************
Chempen+ Chemical Structure Drawing
Software for Windows
http://www.ici.net/cust_pages/hfevans/chempen.htm

Gary <hum...@dial.pipex.com> wrote in article
<31ed37ed.14396...@news.dial.pipex.com>...

Quote
> Hello,

> Someone please help me !  I've been messing around with the winsock
> stuff you can do in Turbo Pascal Windows, but I have come to a hault,
> it seems that the only send data I can use is of PChar form, does
> anyone know how I can make a string into PChar ? Please help I really
> am stuck. If its not possible to make string >> pchar is there some
> other way of inputting data to the computer and making it into Pchar ?

> Please reply to me at hum...@dial.pipex.com as I don't regulary check
> USENET.

> Thanks very much.

> Gary

Other Threads