function comparaCadenas(c1, c2: PChar): integer;
begin
if (c1 = nil) or (c2 = nil) then
result := Integer(c2) - Integer(c1)
else begin
while (c1^ <> #0) and (c2^ <> #0) and (c1^ = c2^) do begin
Inc(c1);
Inc(c2);
end;
if (c1^ <> #0) or (c2^ <> #0) then
result := Integer(c1^) - Integer(c2^)
else
result := 0;
end;
end;