Reading white spaces...

Here's my situation.I'm reading a file that consists of characters including white space.Once I read them I'm counting the occurrences of each character.This means I need to count occurrences of white space as well.If I use ifstream I skip the white spaces and I dunno the filesize so I cant use getline.What do I do?

but I'm reading a variety of files like pdf's images etc...I'm then encoding the files...so I need to get counts of each character in the file..and then make some modifications...would getline help me?

binary files do not contain characters as such, and attempting to count them in binary files is meaningless. But nonetheless, you can use stream's get() function to read the file one byte at a time. Just be aware that binary files contain lots of unreadable bytes.