OK so I've almost completed a program. However whilst it works on Windows I would prefer to run it on my Mac to test differences in performance (my Mac has much faster hardware).
I have an unordered map that is storing in values from a text file and I am also copying this map to reverse the key/value pairs.
The text files keep adding a new line, and from research I've found it to be because Windows adds it's own carriage return (why?!) and it's at the end of every second element in my map. The file is "stringx,stringy" and so am using stringstream to split the string x and y into the key/value pair.
EDIT: thanks for the answers guys, worked a treat!
/r/nas the line break indicator because it has always done it historically. Changing it would break god knows how many lines of legacy code. Sad state of affairs really.\rand the\nat the end of the line. When you open the file, do you specify binary or text? If text, CRLF to NL mapping should be automatic.ios::binary), you should not have any'\r'in your input. Try printing the input as hex-numbers [and check that you are not opening the file as binary!] Getline should not return you a string with newline in it anyways! I suspect your problem is in some other part of the code!