I recommend you look here (ofstream::ofstream - C++ Reference) and also at the open method, to figure out how to open ofstreams.
I also recommend you get your files more organized. When you start getting errors like what you describe here:
You're only starting to lose track of what you're doing. You didn't really explain why you keep changing the name of your file objects. I'm compelled to tell you that you can name them anything descriptive. Don't get caught up in minutiae before the program even works. I typically give my file objects plain names like "report".If I change from *b_file* to *e_file* in the second part, I get an *e_file is undefined* error. Is it the *ifstream* statement that DEFINES the file & opens it for reading?
If you have to process even a lot of files, you should tackle them one at a time. Keep one ifstream object alive to read from, and ofstream object alive to write or append to, and iterate over an array of file paths, with the body of the loop doing IO operations.