4 ms·
sprintf tells you how many characters it has written, so there's no reason you can't use it for non-null-terminated strings.
by TazeTSchnitzel 5y ago
sprintf tells you how many characters it has written, so there's no reason you can't use it for non-null-terminated strings.
- comfydragon 5y agowilliamvds's point is that the first argument to printf is still itself a null-terminated string, so it's basically turtles all the way down if you're using the C standard library.
- TazeTSchnitzel 5y agoTheir comment talked about two things, and the sibling comment addressed the other one.