I ran into sprintf's dependence on locale recently when trying to use it in a WebAssembly module. Since I was compiling for the browser, I wanted to not depend on locale. Even setting aside the locale stuff, the wasi sdk still wanted to pull in file-related things like read/write/seek. I just wanted to do formatted print to a pre-existing buffer.
I ended up using nanoprintf — it's a single header file and in the public domain.
I ended up using nanoprintf — it's a single header file and in the public domain.
(https://github.com/charlesnicholson/nanoprintf)