Is it right? Does "w+" and "w+b" truncate the file?

Modes 'w+' and 'w+b' open and truncate the file.

Is it right? I thought that the + means exactly that it does NOT truncate the file. Doesn’t it?

You want a+ to not truncate.

This is the same as the C fopen() function. See e.g.: fopen, fopen_s - cppreference.com (or man 3 fopen if you’re using a Unix variation).

One may need “r+” or “r+b” instead if there’s a need to write to arbitrary offsets in the file. Append mode always writes to the end of the file.