[fpc-pascal]longint -> Pchar

Marco van de Voort marcov at stack.nl
Wed Dec 10 11:42:58 CET 2003


> Is there a (hopefully easy) way to convert a longint variable to either
> Pchar / string / ansistring without changing the contents of the variable?
> For example, longint variable containing "12345" converted to one of the
> string types would still print as "12345".  Closest I've been able to get so
> far results in the converted variable being printed as some strange
> characters ...

You always need a conversion. Either str() (in system) or sysutils.inttostr.

The memory layout of a string and longint is not the same.




More information about the fpc-pascal mailing list