fstream as function arguments

I am rather new in C++ (or coding in general for that purpose) and am working on a function that causes me a lot of trouble...

My function is supposed to take 4 parameters: 1 ifstream 1 ofstream and 2 strings (filenames for ifstream and ofstream). Then it is supposed to:
- open the ifstream and ofstream files using the filenames from the string arguments. Before that the strings need to be converted to cstrings using strVar.c_str().
- Read the content of the ifstream file (1 word/string) and write it to the ofstream.
- Close the ifstream and ofstream
- Report the success

Both text files are in the same folder like the .cpp. The "read" file (user needs to input it) is "text.txt" and contains 1 word "example" to be read.
The outputfile "text_new.txt" is empty.

Here's my attempt that gets around 1x10^6 errors... so I am in desperate need of advise. I am sure this could be done easier (no function necessary), but for educational purposes I'd like to know how to do this. Thanks so much in advance!