Connecting Tech Pros Worldwide Forums | Help | Site Map

Reading binary files: problem with argument types

Newbie
 
Join Date: Oct 2007
Posts: 8
#1: Oct 27 '07
Hi,
i have a text file input.txt that contain binary data
i'm reading a stream of bytes and then converting them from unreadable symbols to a string of characters.
My conversion is from unsigned char array to integer array of 1's and 0's (binary)

my problem is when i read from the file using "get" or "getline" these functions read into a char array but my data is in Bytes = unsigned char array
i'm wondering is ther any way to read Byte or unsigned char brom a file in C++

Moderator
 
Join Date: Mar 2007
Location: North Bend Washington USA
Posts: 5,382
#2: Oct 27 '07

re: Reading binary files: problem with argument types


Have you opened the file as a binary file?

If so, then you should, be able to read in the bytes unaltered.
Reply