Why can't I use PChar(sString)
within Scripter?
Problem:
sString = 'MyText f‰ƒ€ÿ H¸Äÿÿÿÿÿÿÿ‰'
sString = 'MyText ш„Œÿ ‹EüƒÀ‰Eüë'
(After "MyText" there is a Asciicode #0, but the String is not terminated.)
Usually sString := PChar(sString)
would fix this problem. In Delphi I can use this function, but not in TMS Scripter
Even this did not work:
var
Helper: PChar;
begin
...
Helper := sString;
Helper has the same problem, String is not terminated at the first occurence of #0
My temporary solution looks like this:
function PChar(sString: string);
var
x: integer;
begin
for x := 1 to Length(sString) do begin
if sString[x] = #0 then break;
end;
Result := Copy(sString, 1, x-1);
end;
This basically solves my problem but needs CPU time because I have to iterate through every string.