Used sprintf_s instead of sprintf and give it a wrapper function on s2string.