Ok this comes as two questions: what is the best variable for storing bianary data and how would I send That through a XOR gate? When I searched it didn't really do anything because XOR is a binary operator. I remember how to open o file in binary form from my last post on it. My preveous post on XOR was for text based and is not of any revalance to this.0

The "^" character is a bitwise XOR operator in C++.

I know the operators n' stuff and how to use it with simple stuff; I want to use it with fstream in binary mode.

ostream& write ( const char* s , streamsize n );

This will put it into a character array. If you associate the array with a union of numeric data types, you can then manipulate it mathematically and/or logically.

What? Could you explain that a little more and where I would put the stuff to open it in binary fform sorry, its a little confusing.

OK. Let's say that you want to read four bytes in at a time, and access them as a 32-bit integer. (You can adjust this for your needs; I'm keeping the example as simple as possible.)

- Create a union of a 4-character array, and an int32_t.
- do a stream.read() of four characters, using the character array in the union above
- access the read data using the int32_t in the union above

There may be other/better ways to do this, but this is what I use.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.