Übersicht

CharToByte

Die Funktion CharToByte ist eine reine Typkonvertierung. Die Variable oder Konstante Char wird in den Typ Byte umgewandelt.

Syntax

< Variable vom Typ Byte > := CharToByte ( < Variable oder Konstante vom Typ Char > ) ;

Parameter

< Variable oder Konstante vom Typ Char >

Beispiel


1
2
3
4
5
6
7
8
9
10
11
12
13
14
PROGRAM test_CharToByte;
 
DEVICE = mega644P;
 
VAR
  b1 : Byte;
  c1 : Char;
 
BEGIN
 
  c1 := 'C';
  b1 := CharToByte(c1);
 
END test_CharToByte.

In Zeile 11 wird der Char-Variablen "c1" der Konstanten-Wert "C" zugewiesen.

In Zeile 12 wird durch die Funktion CharToByte der Inhalt der Char-Variablen "c1" gelesen und in die Byte-Variable "b1" geschrieben.

Das Zeichen "C" entspricht dem Bytewert $43, der jetzt in der Variablen "b1" steht.

siehe auch

ByteToChar



Übersicht