A coule of things.
but of cource when i define a variable with byte it gives me characters rather than numbers for
This is not true. When you typedef an unsigned char you still have an unsigned char. Next, there are three kinds of built-in variables in C/C++. There are integers, floating point and pointer variables.
An unsigned char is not a pointer or a floating point variable. So, it has to be an integer. In fact, it's just an 8-bit integer that contains integer values.
Then when you cout << achar you should see the integer value. However, the << operator with a char on the right
assumes you want the ASCII glyph rather than the number. So yo get A instead of 65.
There are many << operators. The one with an int on the right
assumes you want the integer value so you see 65 and not A.
All you have to do is assign your char to an int to see the numeric value.
You do not typecast.
In fact, you never typecast in C++ unless a) you a calling a relic C function, b) you are doing very low level file I/O or c) your design is faulty.