Why create "realdata" and not pass "strlen(data.str().c_str()) in the function?