[fpc-devel] move(xx, ansistring[1] versus ansistring, len)

JoshyFun joshyfun at gmail.com
Tue May 13 00:10:53 CEST 2008


Hello Martin,

Monday, May 12, 2008, 11:27:08 PM, you wrote:

MF> Hi,
MF> I am trying to find some info on how I can use move to archive the
MF> following:
MF> I am looking for an equal replacement of
MF> move(somepchar^, ansi_str_dest[1], len)
[...]
MF> I could prefix it with "if length(dest) > 0 then ", but I would prefer
MF> something less noticeable...

I had not checked it but I think you can use the typecasting:

move(somepchar^,pchar(ansi_str_dest)^,len);

as typecasting an ansistring to a pchar should return (repeat "I
think") a pointer to ansi_str_dest[1], and if length(ansi_str_dest)=0
then the pointer should be $00000001 :-? which should not raise any
kind of range check.

-- 
Best regards,
 JoshyFun




More information about the fpc-devel mailing list