reading binary file to unsigned char

Jul 23, 2009 at 10:45pm
Hi all,
For my program I need to read data from a file then "join" two chars as an unsigned short.
Currently I am using fstream to read the file (to signed chars) then making another array which is unsigned and copying the values. I know this is the long way of doing it, but I haven't a clue how to read the values as unsigned to start with. Is there a trick I'm missing?

Thanks in advance
Jul 23, 2009 at 11:17pm
Just do
uchar *p=(uchar *)pointer_to_the_buffer_which_read_just_wrote_to;
Jul 24, 2009 at 12:10am
Ah... POINTERS! Haha thank you once again helios.
I think I've been staring at this too long, my brain is mush...
Topic archived. No new replies allowed.