Board index » delphi » char - byte or byte - char

char - byte or byte - char

Is there a way to convert between char and byte or visa versa?

Thanks
 Roelf Pringle

 

Re:char - byte or byte - char


s...@stocknet.co.za (Roelf Pringle ) writes:

Quote
>Is there a way to convert between char and byte or visa versa?

     Look in your manuals for Chr- (byte->char) and Ord-
     (char->longint) functions.

--
____________________________   Nil sub sole stabile
http://www.iki.fi/~pemakine/               Fiat lux

Re:char - byte or byte - char


Quote
Roelf Pringle wrote:

> Is there a way to convert between char and byte or visa versa?

> Thanks
>  Roelf Pringle

if you can convert to integer you can typecast as byte.  I had to do
this to strings and it works well

Re:char - byte or byte - char


On Sun, 13 Oct 1996 15:04:13 -0700 Roelf Pringle (s...@stocknet.co.za) wrote:

Quote
> Is there a way to convert between char and byte or visa versa?

There is no convertion needed. What you may need is type casting Char(AByte)
or Chr(AByte) and Byte(AChar) or Ord(ACHar).

Quote
> Thanks
>  Roelf Pringle

--
*********************************************
* nin...@redline.ru, myacco...@glas.apc.org *
*********************************************

Re:char - byte or byte - char


Quote
Roelf Pringle <s...@stocknet.co.za> wrote:
>Is there a way to convert between char and byte or visa versa?
>Thanks
> Roelf Pringle

The byte is the ASCII code which is Ord(ch), ch being a char variable.
To make the char from the byte use Chr(n), where n is a byte variable.

Other Threads