snprintf : simple way to force . as radix?

后端 未结 3 698
伪装坚强ぢ
伪装坚强ぢ 2021-01-25 05:26

My program was not behaving correctly on one machine so I started to hunt for the bug, and I discovered that on that machine, snprintf uses a comma (,), not a . (dot) as 99% of

3条回答
  •  孤街浪徒
    2021-01-25 05:37

    You should be able to change your locale-setting using the setlocale-function to make snprintf use a dot. Try setting it to "POSIX" or "C". (setlocale(LC_ALL, "POSIX")

提交回复
热议问题