Second param of that signature is for inserting multiple copies of a letter, so try: `strBuf.insert((size_t)dwRead, '\0')`