I have to create a function which passes in an ifstream& output and an ofstream. The ifstream is a file, which I need to take each word and translate. My issue is how do I deal with spaces and is it preferable that I do a output.get(ch) rather than an output.getline(string,index).
I then need to call the function recursively to do the encode the whole file, so I need to putback all of the string after this word.
This is the function header:
void translateStream(ifstream& inputStream, ofstream& outputStream)
Note, I cannot use vector, and the only includes I have available to me are
#include<iostream>
#include<cctype>
#include<fstream>
#include<cstring>
If you need to honor existing newlines in the input file then you probably want to grab input "lines" and tokenize them so that you can reproduce the format on output. Something like:
Is there no other way other than doing a getline? As I believe I would have to add a new header for Tokenize, which is something I cannot do (restrictions for my exam on what can and can't be done!)