snprintf into tmp char buffer and copy into buf