My understanding is that adding r+
opens for both read and write (just like w+
, though as pointed out in the comment, will truncate the file). The b
just opens it in binary mode, which is supposed to be less aware of things like line separators (at least in C++).