i want to be able to read the file that the user inputted and format the text then output the formatted text into the output file how do i pass the input and output files to the function, read the input file and so i can reformat it
int reformat(int length, ifstream& ist, ofstream& ost) {
char c;
return length;
}
int main(int argc, char* argv[])
{
int length=70;
cout << "Please enter input txt file name to be formatted: ";
string iname;
cin >> iname;
ifstream ist(iname.c_str()); // ist is an input stream for the file named name
if (!ist) exit(EXIT_FAILURE);
cout << "Please enter name of txt output file to for the new formatted version: ";
string oname;
cin >>oname;
ofstream ost(oname.c_str()); // ost is an output stream for a file named name
if (!ost) exit(EXIT_FAILURE);