I have two files, one with text that needs decoding "encoded.message" and one for an output file "output.txt". I want to import and the encoded message one character at a time, then I already have some code to change the text, but at the moment I just want to export the text character by character to "output.txt". However I don't understand the terminology required to import, export and examine and transfer characters. I am sure its really simple, but help would be appreciated.
On re-reading - I think I should point out that I am not really trying to decode encrypted messages - it is just part of the course that I am struggling with at the moment!
#include <iostream>
#include <fstream>
#include <cctype>
int main ()
{
constchar* const input_file_name = __FILE__ ; // "whatever.txt"
constchar* const output_file_name = "out.txt" ;
// open the files
std::ifstream input_file(input_file_name) ;
std::ofstream output_file(output_file_name) ;
char c ;
while( input_file.get(c) ) // for each character (including white space) in input
{
constchar modified = std::toupper(c) ; // some code to change the text
output_file.put(modified) ; // write the modified character to output
}
}