Writing encrypted value to file.
Well, I'm having a little problem writing an encrypted value to a file.
To be a little more specific, I used an XOR like method to encrypt a string, and tried writing the value to a file. The problem is, it's only writing the first character in the string, or nothing at all.
Here's a code snippet:
Code:
string4 = "Text: "+string1+"\nText: "+string2+"\nText: "+string3;
for ( unsigned int i = 0; i < string4.length(); i++ ) {
string4[i] = string4[i]^key[i];
string4 = string4[i];
}
ofstream file;
path_source = "C:\\Users\\%USER%\\Documents\\dir\\";
path = path_source+string1+path_ext;
file.open (path.c_str());
file << string4;
Does anyone see any problems, or know why this may be occuring?