Hello guys, this is my first post, so don't be harsh if I do something stupid.

Well, the reason why I'm posting here is because I need to find a method to alter the stream itself, not just the buffer I send to a variable with "file.Read(".

For example, lets say i have a file whose bytes are as follows:
05 FF 3E 23 80 BD

As I'm using MFC I'd use 'file.Open' to open the file, and 'file.Read' to send the stream above to a buffer (char *) variable.

What I want to do is to change the stream to something else before I use the Read function so that it will be something different when I read the stream whilst still keeping the file untouched.

The reason I need this is for encryption purposes, and because I dont want to create a temporary file on the computer.

By the way, I don't want just to send the stream to the buffer and then process it, I want to change the stream itself.

Any help is appreciated.
Regards, Gabriel.

6 Years
Discussion Span
Last Post by Ancient Dragon

Lets say we had the above file "05 FF 3E 23 80 BD"

I wanted to use my decription algorythm that would change it to something like:
BF 46 E6 AF 08 99

Before I used the Read function however not changing the actual file. (I already have the decryption algorythm)

Edited by 0dark: n/a


Now how in the world do you expect to decrypt a file without reading it?? Just read the file, decrypt it and save it in memory. I don't see why you need a temp file to do that.


Because the .read function is used several times later (more than 100) and I didn't want to change that because I would have to convert char[4] to int for exemple.. something that the function does by itself.


converting char[4] to int is simple assignment int x = *(int *)buffer; , assuming that buffer contains the binary representation of the int.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.