string is typedef'd to char*.

strf returns a temporary pointer to a buffer that gets used over and over again. So of course, using your own fixed buffer will solve the problem.