c++ - Why is the file I'm writng to printing gibberish? -


i'm not sure what's happening, i'm using ofstream object write file in binary mode.

i writing byte file, file printing gibberish. it's printing type of gibberish: ôß

i have class called byteoutput function called inbyte defined so:

void inbyte(int byte) {     ostreamobj.write(&buffer, byte & 255); } 

&buffer reference bit buffer using store byte of data

in main, defined ofstream obj , opened file in binary using:

obj.open("tester", std::ios::binary); 

i write byte of data file using byteoutput object using:

writeobj.inbyte(1001011); 

however, when check file, hieroglyphics. not show letter k, has binary presentation 1001011.

what doing wrong?

this

writeobj.inbyte(1001011); 

calls function integer = 1,001,001 decimal, not binary.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -