简体   繁体   中英

Reading the unsigned char from the file using << operator

I should read unsigned char from file and I don't know is it a char or a number. I can use the " << " operator only.

So if unsigned char in a file is a char I have no problems, but if it is a number it does not read it into a variable .

Data in files does not have types. There are no "chars" or "unsigned chars" or "numbers".

A file contains bytes . Period.

It is down to you to decide how to interpret those bytes.

Typically we have a convention or "file format" to help us decide how to do that for some given file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM