Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

String / PByte / Byte

68 views
Skip to first unread message

NIRAV KAKU

unread,
Jul 22, 2000, 3:00:00 AM7/22/00
to
Hello there,

A very basic object pascal question to you all....

An [in/out] paramerter requires a PByte. I want to pass a string in that
parameter. What are my options?

NIRAV KAKU

Werner Lehmann

unread,
Jul 22, 2000, 3:00:00 AM7/22/00
to
NIRAV KAKU wrote:
>
> An [in/out] paramerter requires a PByte. I want to pass a string in that
> parameter. What are my options?

MyProc(@MyStringVar[1])

May need a cast: MyProc(PByte(@MyStringVar[1])).

WL


Peter Below (TeamB)

unread,
Jul 22, 2000, 3:00:00 AM7/22/00
to
In article <39792cd0_1@dnews>, Nirav Kaku wrote:
> An [in/out] paramerter requires a PByte. I want to pass a string in that
> parameter. What are my options?


Var
pB: PByte;

pB := @someString[1];

Now pass pB. This will work *unless* the called function writes to the
address you pass it. If it does that it must know the size of the string
memory (Length(somestring)+1, including the #0 terminator) and guard
against writing beyond the end of buffer.

Peter Below (TeamB) 10011...@compuserve.com)
No e-mail responses, please, unless explicitly requested!


NIRAV KAKU

unread,
Jul 26, 2000, 3:00:00 AM7/26/00
to
What I did was...

//move data into array of byte
Move(Pointer(TheString)^, TheArray, Length)

//pass the array
MyProc(@TheArray)

NIRAV KAKU


NIRAV KAKU wrote:

> Hello there,
>
> A very basic object pascal question to you all....
>

> An [in/out] paramerter requires a PByte. I want to pass a string in that
> parameter. What are my options?
>

> NIRAV KAKU


0 new messages