So, I've been testing out what you suggested and tried converting both my streams into a single stream.
So far so good, I'm getting the same issue as before but that's because I'm not flushing the stream, and now at least I know how to use fstreams and that using an ofstream and an ifstream on the same file isn't a great idea.
I'm using seekp() temporarily at L22 to serve as a replacement for fflush (so as to at least get the first cout to print out testLine correctly), which I need as I don't seem to understand how to use it correctly.
Here's what I tried to write at L29, 43, 47, 53, and 57:
And for each of these I get the error:
|error: cannot convert 'const string {aka const std::__cxx11::basic_string<char>}' to 'FILE* {aka _iobuf*}' for argument '1' to 'int fflush(FILE*)'|
|
Needless to say, with how inexperienced I am with C++ and programming as a whole, I have no idea what any of this means.
The only clue I have is that I know arrays can't be copied and strings are arrays, so I'm guessing the function converts by copying and that's what's causing the issue? Other than that I have no idea what's wrong with this, and even if that's the issue I don't know how to fix it.