[fpc-pascal]Re: longint -> Pchar / string / ansistring

Balogh, Karoly (Charlie/iNQ) charlie at scenergy.dfmk.hu
Wed Dec 10 03:51:56 CET 2003


Hi,

On 03.12.10., baron kractor wrote:

> 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 ...

Maybe i misunderstood you on IRC, you need the value of the variable
or the contents of the variable? 

If you want to have the numerical value as string, simply use the Str() 
function of the System unit. 
See the docs: http://www.freepascal.org/docs-html/ref/refsu177.html

I thought you needed the contents of the variable to printed out
from byte to byte. (for eg. you have a 4 byte ID number, as a longint 
and you wanted it as a string.).

Bye,
-- 
Charlie/iNQ
.:%[ Cybernetic Hydraulic Android Responsible for ]%:. 
.:%[    Logical Infiltration and Exploration      ]%:.
.:%[         Member of TeamOS/2 Hungary           ]%:.
.:%[     Member of Hungarian Amiga User Group     ]%:.





More information about the fpc-pascal mailing list