Something is wrong with my program logic. I am trying to merge to files into one. The program starts, but nothing happens, it doesn't close, and the mergefile doesn't update. v.v
The first file is FemaleClients.rtf and consists of these characters:
The second file, MaleClients.rtf, consists of:
They are supposed to merge into MergedClients.rtf. If you can find the error in the logic without creating those folders, awesome. If not, I understand it would take awhile to create these folders and go through trial and error. Anywho, heres my code. Don't laugh.
Thank you for noticing. Fixed it, and the program still doesn't close. Also, now when I open the .txt file, it says "boolean inWritten2" and then displays a zillion "0's". When I open the rtf file, still no merge :(
The logic is a little mind boggling, is there any special requirements for the merged file? if not.. keep it simple,
1 2 3 4 5 6
// you mention rtf, though you are opening txt files.. is this correct?
merged_clients << male_clients.rdbuf() << female_clients.rdbuf();
Well, this logic is given to my class in an algorithm and we are supposed to transfer it to c++ statements. I'm pretty new to programming, so I probably couldn't write better logic anyways...
Here is my new code, program still doesn't work. I'm curious to what the statement "merged_clients << male_clients.rdbuf() << female_clients.rdbuf();"
does, couldn't find a straight forward explanation from google.
I'm curious to what the statement "merged_clients << male_clients.rdbuf() << female_clients.rdbuf();"
ios::rdbuf() returns a pointer to the stream buffer, and ostream::operator<< has an overload to output stream buffers. Internally, you could picture it as while loop reading and writing each character to the output stream.
Well, this logic is given to my class in an algorithm and we are supposed to transfer it to c++ statements.
In that case, disregard the code from previous post.
Lines 34, 42, 49, 54, output a space between the number and name. Line 49 missing an endl. Line 58 missing !. !(inFile2.eof())