problem with binary input

Hi!
I'm trying to read a file byte per byte.The file contains "0000 0000 0101 0000..."
the code i use is:
1
2
3
4
5
6
fstream cbf(address,ios::binary|ios::in|ios::ate);
fstream::pos_type size=cbf.tellg();//returns 0,dunno why.
char* chunk=new char[size];
cbf.seekg(ios::beg);
cbf.read(chunk,size);
//etc...etc... 

as the comment shows,for some reason cbf.tellg() returns 0.
I tried cbf.seekg(ios::ate) but no surprise i had the same result.
using python or octave i can easily open the file , so the problem doesn't seem to come from the file itself...
well that's it...thanks a lot in advance for your help!

edit:
if that helps the "0000 0000 0101 0000 ..." sequence above is the sequence of bits in the file , generated by a dynamic huffman algorithm....
thx again for your attention.
Last edited on
ok i identified the problem.it was really stupid and i'm glad nobody wasted time on this post.
Topic archived. No new replies allowed.