yeah, you'd either need to use binary reading or writing, or you could try using text, but you'd need to make sure that everything can be read back from teh file correctly. for example, if one of your letters turns into a newline '\n' it'll throw off your entire file.
so you'd need to do something like this:
edit: you can use that code, but you're gonna wanna fix up the encrypt function, because I left some possible big time run-time errors in there...
std::string encrypt(const std::string in);
std::cout<<"Enter a word: ";
* I'm "encrypting" the word, and outputting the result to console and
* to file to read from later.
* I'm closing and clearing the stream, then Re-Opening it for reading
* in text mode
* Now I get the result back from the file, en(de)crypt it, and then
* output it to the console
std::string encrypt(const std::string in)
short int len;
register short int x;
register short int y;
* I'm finding out the length of the string now to save processor time
* later, and I'm making sure there's enough space in retval to hold
* the result (which will be the same length as the string
* here's the heart of the 'encryption'. what it does is an XOR
* encryption, and if the resulting character isn't something that can
* be seen on a screen (or read from a file correctly), then it moves
* to the next character in the key, and re-encrypts the character in
* the word.
for(x=0,y=0; x<len; x++,y++)